你好。你用什么方法解决掉vb运行后进程里仍有excel
发布网友
发布时间:2024-10-02 07:05
我来回答
共2个回答
热心网友
时间:2024-11-25 12:27
需要编写代码删除excel进程,如果是vb.net,可调用如下过程
Public Sub EraseExcel()
Dim pTemp As System.Diagnostics.Process()
pTemp = System.Diagnostics.Process.GetProcesses()
Dim pTempProcess As System.Diagnostics.Process
For Each pTempProcess In pTemp
Dim sProcessName As String = pTempProcess.ProcessName
Dim sProcessID As Int32 = pTempProcess.Id
If StrComp("excel", sProcessName, CompareMethod.Text) = 0 Then
Dim pProcessTemp As System.Diagnostics.Process
pProcessTemp = Process.GetProcessById(sProcessID)
pProcessTemp.Kill()
pProcessTemp.Close()
End If
Next
End Sub
热心网友
时间:2024-11-25 12:28
直接就用xlapp.quit