The working way of stopping errors when saving things?
Well i'm trying to save a file and i put in "on error goto _____" and then it went there all the time, even if there wasn't an error (aka pushing the cancel button).
Is there not something else i can do to show what should happen when people press the cancel button when using the save/open command dialog boxes?
If not, maybe i'm not placing my error thing in the right place. Could someone tell me where to put it in accordance to where it loads the save/load screen and in accordance to where it reads the file.
Re: The working way of stopping errors when saving things?
VB Code:
Private Sub Command1_Click()
On Error GoTo Err1
CommonDialog1.CancelError = True
CommonDialog1.ShowOpen
Exit Sub
Err1:
'If cancel button is clicked
If Err.Number = cdlCancel Then
Exit Sub
End If
End Sub
Re: The working way of stopping errors when saving things?
Does this help?
VB Code:
Private Sub Command1_Click()
On Error GoTo blah
CommonDialog1.CancelError = False
CommonDialog1.ShowSave
'so something here...
Exit Sub
blah:
MsgBox "Error #" & Err.Number & " - " & Err.Description, vbExclamation, "Error"
End Sub