|
-
Aug 21st, 2001, 04:51 AM
#1
Thread Starter
Addicted Member
It is possible to save changes before a program shuts down like on an error?
It is possible to save changes before a program shuts down like on an error?
Thanx
-
Aug 21st, 2001, 04:54 AM
#2
Fanatic Member
Why is the program shutting down? Is it an unhandled error in your app. or a system error?
-
Aug 21st, 2001, 04:57 AM
#3
Hyperactive Member
During your programs operation, you could put
VB Code:
Private Sub testfunc()
On Error goto ErrCatch:
'Code Goes Here
ErrCatch:
'Enter Code to Save Data
Msgbox "An error has occurecd", vbexclamation, "Error"
End Sub
This Business Is Binary. Your a 1 or a 0. Alive or Dead. (AntiTrust)
-
Aug 21st, 2001, 05:13 AM
#4
Thread Starter
Addicted Member
at the begining of every function and sub?
-
Aug 21st, 2001, 05:17 AM
#5
Hyperactive Member
if every sub has a probably cause to produce an error then yes. i would create a function to save the data a produce the msgbox to save on code type, for example
VB Code:
Private Sub ErrTest ( )
On Error Goto ErrCatch:
'code goes here
ErrCatch:
DisplayError
end sub
VB Code:
Public Sub DisplayError()
'Code to save data
'display msgbox
End Sub
This Business Is Binary. Your a 1 or a 0. Alive or Dead. (AntiTrust)
-
Aug 21st, 2001, 08:17 AM
#6
New Member
It might be quite dangerous doing this, I wrote a excel macro which saved the document when an error occurred. Unfortunately it was in a template and when I wrote it and couldn't save itself to the correct directory as it was written to save the doc based on the document not the template. This led to it saving itself with an error status in the macro which, when I tried to open it again Dr. Watsonned Excel. I can't remember how I got round it now, I think I automatically closed the app without saving if this happenned probably the safest thing to do in the circumstances.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|