我不明白为什么这不起作用。
我已经进入注册表并删除了下面的注册表项,但仍然没有乐趣。错误出现在For Each循环中。如果有人可以提供帮助,将不胜感激。 我正在使用.net框架1.1 HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ PerfProc \ Performance \ Disable performance counter
If System.IO.File.Exists(path) Then
System.IO.File.Delete(path)
ExcelApp.DisplayAlerts = False
ExcelApp.ActiveWorkbook.SaveAs(path)
ExcelApp.DisplayAlerts = True
ExcelApp.Quit()
MessageBox.Show("File Exported to: " & path)
Dim proc As System.Diagnostics.Process
For Each proc In System.Diagnostics.Process.GetProcessesByName("EXCEL")
'Debug.Print(Now() & " - Killing process ID " & proc.Id)
proc.Kill()
Next
Else
'saves the file
ExcelApp.DisplayAlerts = False
ExcelApp.ActiveWorkbook.SaveAs(path)
ExcelApp.DisplayAlerts = True
ExcelApp.Quit()
Dim proc As System.Diagnostics.Process
For Each proc In System.Diagnostics.Process.GetProcessesByName("EXCEL")
'Debug.Print(Now() & " - Killing process ID " & proc.Id)
proc.Kill()