Objective: To open, read and close an Excel file.
The code below works but does not close down the worksheet properly afterwards. The symptoms are:
Double-click on the spreadsheet in Explorer and it 'flicks open' then instantly closes again.
Double-click on any other spreadsheet in Explorer and both the original and other spreadsheet are open in Excel.
How can I persuade Excel to really close the workbook.
I am wondering whether there is some library still in RAM holding the workbook open.
Excel stays on Task Manager throughout. Behaviour on subsequent opening is as usual after I close the stranded Excel session.
Set objXL = CreateObject("Excel.Application")
Set objWkb = objXL.Workbooks.Open(strDPIFile, , True)
' turn warnings off
' DoCmd.SetWarnings False
Set objSht = objXL.ActiveWorkbook.Sheets(1)
' my code removed ....
set objxl.visible = true
objWkb.Close
objXL.Workbooks.Close
objXL.Quit
The code below works but does not close down the worksheet properly afterwards. The symptoms are:
Double-click on the spreadsheet in Explorer and it 'flicks open' then instantly closes again.
Double-click on any other spreadsheet in Explorer and both the original and other spreadsheet are open in Excel.
How can I persuade Excel to really close the workbook.
I am wondering whether there is some library still in RAM holding the workbook open.
Excel stays on Task Manager throughout. Behaviour on subsequent opening is as usual after I close the stranded Excel session.
Set objXL = CreateObject("Excel.Application")
Set objWkb = objXL.Workbooks.Open(strDPIFile, , True)
' turn warnings off
' DoCmd.SetWarnings False
Set objSht = objXL.ActiveWorkbook.Sheets(1)
' my code removed ....
set objxl.visible = true
objWkb.Close
objXL.Workbooks.Close
objXL.Quit
Last edited: