To cause a procedure to handle relatively simple runtime errors without branching to a separate error-handling routine, you can use a form of the On Error statement that lets you deal with errors "in line"; that is, directly in the code that caused the error, rather than in a separate routine.
This example checks for errors when saving a 3270 or 5250 session document.
If the save operation fails, an error message appears. If the save operation succeeds (Err.Number returns 0), a "Save complete" message appears. This macro was written to require the error handler; without it, the macro terminates with an error if the SaveSettings method fails.
Dim theError As Integer
On Error Resume Next
theError = Err.Number
Select Case theError
MsgBox "Save complete."
MsgBox Err.Description & "."