-
My app launches an Excel which I can't get rid of!
I'm using
Code:
oXL.DisplayAlerts = False
oXL.ActiveWorkbook.Save
oXL.Application.Quit
Set oXL = Nothing
where oXl is the Excel.Application object. I've tried it
both invisible and visible and the EXCEL.EXE will not
disappear from the Task manager (no errors generated).
I'm assuming this is because I still have an 'un-Nothing-ed'
object reference somewhere...is it?
And what can I do about it?
Please help!!!!!
:cool:
Dan
-
Hi,
You could try this :
1) Find a handle to the app (by it's caption and the FindWindow API)
2) Send this window a WM_CLOSE ( &H10 ) with the sendmessage API.
Worked for me so I hope it will work for you too...
Bye
-
That night work, but...
a) the window actually closes (in visible mode), its the excel.exe I can't get rid of.
b) I'd prefer not to be so heavy handed...I don't want to be leaking resources all over the shop.
Thanks for the suggestion though,
:cool:
Dan
-
add an
oxl.quit
in there and it should die gracefully.
-
see getobject
example in VB help
and also at runtime add watch on ur
xlsobject.application
u will get all the properties
-
Thanks for your suggestions peeps, but none of them seem to work :(
I can't kill it, I need to release everything properly so no files are marked as locked and I can use them again when I next run my app.
I'll keep trying I guess...
:cool:
Dan
-
It should be:
oXL.DisplayAlerts = False
oXL.ActiveWorkbook.Save
oXL.Workbooks.Close
oXL.Application.Quit
oXL.Quit
Set oXL = Nothing