数据导出自动保存问题(关于vb与excel)
首先定义
Set xlApp = CreateObject("Excel.Application")
Set xlBook = Nothing
Set xlSheet = Nothing
Set xlBook = xlApp.Workbooks().Add
Set xlSheet = xlBook.Worksheets("sheet1")
数据导出后使用
xlApp.Application.Visible = false
不显示excel窗口,但是系统已经自动打开excel进程,如果使用xlBook.SaveAs c:\filename.xls 如此文件已经存在不能自动覆盖原文件。还有导出后的excel进程怎么自动关闭
使用
Set xlApp = Nothing '"交还控制给Excel
Set xlBook = Nothing
Set xlSheet = Nothing
后发现excel进程任然存在。
注:如将xlApp.Application.Visible = true,显示出导出数据并打开excel窗口,无此问题。
问:怎么自动保存导出文件并关闭excel进程!