我用VB6.0做出的exe程序,为什么excel退出后exe程序后仍然在后台运行?

我用VB6.0做出的exe程序,为什么excel退出后exe程序仍然在后台运行?
VB6.0代码如下:
Dim oExcel As Object, fn As String
fn = App.Path & "\工作簿.xlsm"
Set oExcel = CreateObject("Excel.Application")
oExcel.Visible = True
Set fso = oExcel.Workbooks.Open(fn, , , , "bb")
Set oExcel = Nothing
当关闭excel文件后,电脑桌面上还留有exe文件的图标,查看windows任务管理器后,发现exe程序仍然在后台运行。
请问怎 么样才能做到,当关闭excel文件后,电脑桌面上不残留exe文件的图标,exe程序也同时关闭呢?
最后加一句
oExcel.Quit'退出Excel程序!结果:能打开,但是另外“出现了:
Run-time error 91
Object variable or With block variable not set”错误!请高手解答一下,希望能在我原来的代码的基础上完善一下,谢谢!

次序:
oExcel.Quit
Set oExcel = Nothing追问

打开还是出现这个错误,怎么解决呢?

追答Dim oExcel As Object, fso as Object, fn As Stringfn = App.Path & "\工作簿.xlsm"Set oExcel = CreateObject("Excel.Application")Set fso = oExcel.Workbooks.Open(fn, , , , "bb")
oExcel.Visible = True
oExcel.QuitSet oExcel = Nothing

这样试试

温馨提示:答案为网友推荐,仅供参考
相似回答