In your program, do you have any code in the QueryUnload event?
If not, you can code that to detect a shutdown. Example:
Code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
'there are 5 unloadmode levels
Select Case UnloadMode
Case vbFormControlMenu 'UnloadMode 0
'form is being unloaded via the Close
'or by hitting the X in the upper right hand corner
'command from the System menu
Case vbFormCode 'UnloadMode 1
'Unload Me has been issued from code
Case vbAppWindows 'UnloadMode 2
'Windows itself is closing
Case vbAppTaskManager 'UnloadMode 3
'the Task Manager is closing the app
Case vbFormMDIForm 'UnloadMod 4
'an MDI child form is closing because
'its parent form is closing
End Select
End Sub
I would play around with vbAppWindows......if someone just shuts their PC off with your program running, then that event might pick it up.