Dim xlApp As Excel.Application
Dim xlbook As Excel.Workbook
Dim xlsheet As Excel.Worksheet
Set xlApp = New Excel.Application
激活EXCEL应用程序
Set xlApp = CreateObject("Excel.Application")
EXCEL文件所在路径
strDestinations = "d:\project\公司" + "\" + "test.xls"
打开工作簿
Set xlbook = xlApp.Workbooks.Open(strDestinations, , False)
打开sheet
Set xlsheet = xlbook.Worksheets(1)
xlApp.Visible = True
我用下面的代码来清空内存:
Set xlsheet = Nothing
Set xlbook = Nothing
Set xlApp = Nothing
但是好象进程管理器中老是有一个excel进程没有关掉,不知道大家是怎么来关掉打开的excel文件进程的?我关闭的方法对吗?
Set xlsheet = Nothing
Set xlbook = Nothing
alapp.Quit
Set xlApp = Nothing