D
David
Hello,
Anybody have the experience where you open an Excel spreadsheet, process the
worksheets, then close it, only to find the PROCESS still running in Windows
Task Manager. This causes a problem next time I run the process, as it locks
the spreadsheet I had opened originally.
The code below describes what I am doing:
Set xlApp = New Excel.Application
xlApp.Visible = True
Set xlBook = xlApp.Workbooks.Open(Forms!Import!txtExcel.Value)
For Each xlSheet In xlBook.Worksheets
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
"tbl_Temp_RT_" & xlSheet.Name, Forms!Import!txtExcel.Value, True, ""
& xlSheet.Name & "!"
Next
xlBook.Close
xlApp.Quit
Set xlSheet = Nothing
Set xlBook = Nothing
Set xlApp = Nothing
Note: The line: " xlApp.Visible = True" is typically "xlApp.Visible=False"
but I wanted to see what was going on...
One final note: If I comment out the FOR...EACH Loop, it closes Excel fine...
Any ideas?
Thanks in advance.
Anybody have the experience where you open an Excel spreadsheet, process the
worksheets, then close it, only to find the PROCESS still running in Windows
Task Manager. This causes a problem next time I run the process, as it locks
the spreadsheet I had opened originally.
The code below describes what I am doing:
Set xlApp = New Excel.Application
xlApp.Visible = True
Set xlBook = xlApp.Workbooks.Open(Forms!Import!txtExcel.Value)
For Each xlSheet In xlBook.Worksheets
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
"tbl_Temp_RT_" & xlSheet.Name, Forms!Import!txtExcel.Value, True, ""
& xlSheet.Name & "!"
Next
xlBook.Close
xlApp.Quit
Set xlSheet = Nothing
Set xlBook = Nothing
Set xlApp = Nothing
Note: The line: " xlApp.Visible = True" is typically "xlApp.Visible=False"
but I wanted to see what was going on...
One final note: If I comment out the FOR...EACH Loop, it closes Excel fine...
Any ideas?
Thanks in advance.