OTWarrior
11-28-2007, 02:54 AM
I currently am trying to use an error handler to make sure that on certain errors the fucntion is stopped, but on any other error to resume anyway despite reporting back the error.
here is the code (key line in red)
Public Function ID_TEN_T_Error()
If Err.Description = "The password is incorrect." Then
MsgBox (Err.Description & vbCrLf & Err.Source) & vbCrLf & _
"Make Sure You Have Selected The Correct File", vbCritical, "Import Failed"
DoEvents
nError = 1
ElseIf Err.Description = "The requested member of the collection does not exist." Then
nError = 1
MsgBox "Required field not found. Please make sure you have imported from an appropriate file"
Else
nError = 2
MsgBox Err.Description & vbCrLf & Err.Source & "Unknown Error ??"
If Err.Number > 0 Then Resume Next
End If
If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True, Password:=""
End If
BrowseFile.Close SaveChanges:=wdDoNotSaveChanges
End Function
I am using a custome variable of "Browsefile" but everything else is the standard
here is the code (key line in red)
Public Function ID_TEN_T_Error()
If Err.Description = "The password is incorrect." Then
MsgBox (Err.Description & vbCrLf & Err.Source) & vbCrLf & _
"Make Sure You Have Selected The Correct File", vbCritical, "Import Failed"
DoEvents
nError = 1
ElseIf Err.Description = "The requested member of the collection does not exist." Then
nError = 1
MsgBox "Required field not found. Please make sure you have imported from an appropriate file"
Else
nError = 2
MsgBox Err.Description & vbCrLf & Err.Source & "Unknown Error ??"
If Err.Number > 0 Then Resume Next
End If
If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True, Password:=""
End If
BrowseFile.Close SaveChanges:=wdDoNotSaveChanges
End Function
I am using a custome variable of "Browsefile" but everything else is the standard