Office中国论坛/Access中国论坛
标题:
求助:在access中用DoCmd.TransferSpreadsheet导入excel文件后怎么释放excel在系统
[打印本页]
作者:
liveevil
时间:
2005-6-6 08:47
标题:
求助:在access中用DoCmd.TransferSpreadsheet导入excel文件后怎么释放excel在系统
在access用DoCmd.TransferSpreadsheet多次导入excel文件后,在windows进程中会发现有多个excel进程在运行。怎样才可以释放这些内存占用,杀死进程?
Set xlApp = CreateObject("Excel.Application")
Set xlApp = New Excel.Application
xlApp.Visible = False
Set xlBook = xlApp.Workbooks.Open(fileName)
For Each xlSheet In xlBook.Worksheets
sheetName = xlSheet.Name
range = sheetName & "!a1:g100"
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, sheetName, fileName, True, range
range = ""
Next xlSheet
Set xlSheet = Nothing
xlBook.Close (False)
'SaveChanges:=False
Set xlBook = Nothing
xlApp.Quit
Set xlApp = Nothing
另外DoCmd.TransferSpreadsheet可以导入整张sheet而不指定range吗?
作者:
海狸先生
时间:
2005-6-6 17:57
导入并不需要这么麻烦(下面就是可以导入整个的) DoCmd.TransferSpreadsheet acImport, 9, "tblDR_得分", paths & "\得分导入.xls", True
欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/)
Powered by Discuz! X3.3