Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Releasing Excel Process

Status
Not open for further replies.

RobS23

Programmer
Jun 4, 2001
161
GB
I am trying to relinquish control of Excel from my VB app to the user. I'm doing things as 'allegedly' they should be i.e.

-xl.quit
-Set xl = Nothing
-Set WkSheet = nothing

But, unless I use End the Excel process is still running, and I don't want to have to shut down my app.

So, how do I release Excel?
 
I had the same problem, and the only thing I came up with was to let the user close the Excel application, since nothing else seemed to work. Add xl.Visible = True before setting it to nothing. I'm sure there's a way to clean up without the user, but I bet there's about 110 objects you have to set to nothing before it'll be gone (Excel exposes a lot via COM). I just let Ecxel clean up after itsself.

Good luck!
 
ok, sometimes you get some strange stuff with this.
Make sure you are not forgeting any other instances you've created.

for example xlBook

Then try to do things on this order:

xlBook.Close
xl.Quit

Set WkSheet = Nothing
Set xlBook = Nothing
Set xl = Nothing

Try also to set all the range instances to nothing before you do this. And make sure you are not losing the reference to your instances during the process.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top