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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determine if user closed linked object

Status
Not open for further replies.

GeorgeDurkee

Programmer
Feb 22, 2000
47
US
I am using VB to create and write to an Excel file. The user sometimes wants to remain in excel and sometimes not. How can I tell if he has closed Esxcel using the Excel close and still have the ability to close it myself if I need to?

 


Do a search for WaitForSingleObject in the VB help. I think it's what you're looking for.




Mark
 
I'm not familiar with the Excel way of things...

However, a decent COM object does not terminate when there are still references to its interfaces. Did you test what happens to your reference if you shut down the Excel UI?

The WaitForSingleObject approach should not be necessary in the world of COM....
Greetings,
Rick
 
This isn't so much a COM issue as a cleanup issue.


My app creates and populate an Excel file. The user then wants to view the output and return to my code to do something else that the program does.

If he closes Excel, using standard Excel processing before he returns to my code, then I'll go on with whatever he wants to do. If he does not close Excel, then I want my code to do it so I have a clean connection and clean up the memory usage and just do housekeeping.

He can close Excel while my tool is still running and it geneeataes a trappable error, but I'd prefer not to use error trapping for the condition if I don't have to.

I need a way to tell if Excel is still running before I try to close it and reset the object variables to Nothing.

Thanks

 
Then you'ss have to do as Mark says...
Greetings,
Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top