Access 97/Excel 97 OLE problem

MrTibbs

Registered User.
Local time
Today, 18:52
Joined
Oct 10, 2001
Messages
101
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
 
Last edited:
I seem to remeber a similar problem. I think it was because the code came to a stop before the .quit line.

Fuga.
 
.. OLE still struggling

Fuga said:
I seem to remeber a similar problem. I think it was because the code came to a stop before the .quit line.

Fuga.
Fuga,

I have moved a msgbox to below the end of the code to prove these lines are executing and tracked them step by step in the debugger. The lines are being called but Excel does not close :-(
 

Users who are viewing this thread

Back
Top Bottom