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

Automatic shutdown of application when windows is shutdown

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Dear Experts,

Hello,

I am coding in VB 6. I wish my application to shutdown automatically
when Windows 2000 is shut down. Unfortunately application is not
shutting down automatically.

I investigated and found that the following code is not allowing the
application to shutdown.
This code is written in Form_Unload event, which is essentail to be
exectued before exiting the application.


Dim xlApplication as Object

'
' Get Excel application object or create it
'
Set xlApplication = GetObject("", "Excel.Application")
If Err <> 0 Then
Err.Clear
Set xlApplication = CreateObject(&quot;Excel.Application&quot;)
End If
'
' Restore Excel default file path
'
If Err = 0 Then
xlApplication.DefaultFilePath = gXLDefaultFilePath
End If

Set xlApplication = Nothing

Thanks in advance for any assistance.

Regards,

Faiz
 
I have tested it in QueryUnload event but it did not work and also inserted statement XlApplication.Quit but all in vain.

Any guess!
 
Have you tested the code outside of the form unload and query unload, eg in a command button and run it from your application. That way you'll see that the code is good or bad, and isolate any problems from the unloading of the form. What happens when you step through the code in debug? Jim Brown,
Johannesburg,
South Africa.
My time is GMT+2
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top