如果是使用的vba,使用try处理一下,如
Dim App As New MSExcel.Application
try
Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open("D:\Test.xls")
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)'指定工作表
Dim range = ws.range("A3:D10")
range.CopyPicture(Appearance:=1, Format:=2)
ClipBoard.GetImage.save("d:\aaa.jpg")
catch ex As Exception
msgbox(ex.message)
finally
App.quit
End try
杀进程参考
Dim ps As System.Diagnostics.Process() = System.Diagnostics.Process.GetProcesses()
For Each p As System.Diagnostics.Process In ps
output.show(p.processName)
If ("Excel" = p.ProcessName)
msgbox(p.MainWindowTitle)
'p.kill
End If
Next