2wpGD‖

bUW3P‖Err Function

fYQVz‖Returns an error code that identifies the error that occurred during program execution.

HaPjw‖Syntax:


Err

ZN32q‖Return value:

cCixX‖Integer

LFnmB‖Parameters:

ofpgE‖The Err function is used in error-handling routines to determine the error and the corrective action.

HeDXV‖Example:


Sub ExampleError
u8W7v‖On Error Goto ErrorHandler REM Set up error handler
Dim iVar as Integer
Dim sVar As String
oqyWf‖REM Error occurs due to non-existent file
    iVar = Freefile
    Open "\file9879.txt" for Input as #iVar
    Line Input #iVar, sVar
    Close #iVar
Exit Sub
ErrorHandler:
XsE3E‖    MsgBox "Error " & Err & ": " & Error$ + chr(13) + "At line : " + Erl + chr(13) + Now , 16 ,"an error occurred"
End Sub