B
BruceM
I prefer error handling that identifies the error clearly. For instance:
Private Sub Form_Load()
On Error GoTo ProcErr
****Code here****
ProcExit:
Exit Sub
ProcErr:
MsgBox "Error #" & Err.Number & ", " & Err.Description & " - Form_Load"
Resume ProcExit
End Sub
However, I would like to avoid the need to type:
MsgBox "Error #" & Err.Number & ", " & Err.Description & " - Form_Load"
every time. I realize that parts of this line are specific to the sub, but
is there a way I can use a shortcut for part of it, such as:
"Error #" & Err.Number & ", " & Err.Description
or even:
MsgBox "Error #" & Err.Number & ", " & Err.Description
Maybe a function or constant would do the trick, but I don't know how to
pull it off.
Private Sub Form_Load()
On Error GoTo ProcErr
****Code here****
ProcExit:
Exit Sub
ProcErr:
MsgBox "Error #" & Err.Number & ", " & Err.Description & " - Form_Load"
Resume ProcExit
End Sub
However, I would like to avoid the need to type:
MsgBox "Error #" & Err.Number & ", " & Err.Description & " - Form_Load"
every time. I realize that parts of this line are specific to the sub, but
is there a way I can use a shortcut for part of it, such as:
"Error #" & Err.Number & ", " & Err.Description
or even:
MsgBox "Error #" & Err.Number & ", " & Err.Description
Maybe a function or constant would do the trick, but I don't know how to
pull it off.