我有一个问题,一个网络位于共享的Excel 2010文件打开并成功从VB.net编辑,但当我用Excel.Application.Quit()关闭它时,窗口本身关闭,但EXCEL.EXE进程仍然存在打开 .

作为一种解决方法,如果Process.StartTime与我打开excel的时间匹配,我会终止进程,但这可以a)不会杀死任何excel进程,错误地先前保持打开b)可以杀死完全不同的工作簿......

Dim xlp() As Process = Process.GetProcessesByName("EXCEL")
        For Each Process As Process In xlp
            If Process.StartTime >= datestart And Process.StartTime <= dateEnd Then
                Process.Kill()
            End If
        Next

我尝试将表单设置为已保存,但它没有帮助 . 但是,如果我取消共享excel表,那么当工作簿,然后窗口关闭时,该过程也会正常死亡 .

Dim xlApp As Excel.Application = Nothing
Dim xlWorkBook As Excel.Workbook = Nothing
Dim xlWorkSheet As Excel.Worksheet = Nothing

xlApp = New Excel.Application
xlWorkBook = xlApp.Workbooks.Open(Excel_path)
xlWorkSheet = xlWorkBook.Worksheets(sheetName)

' whitchcraft here

xlWorkBook.Close(SaveChanges:=True)
xlApp.Quit()
releaseObject(xlWorkSheet)
releaseObject(xlWorkBook)
releaseObject(xlApp)

请缓解我的痛苦......