Err.Source (property)

Syntax Err.Source [= stringexpression]
Description Sets or retrieves the source of a runtime error.
Comments For OLE automation errors generated by the OLE server, the Err.Source property is set to the name of the object that generated the error. For all other errors generated by BasicScript, the Err.Source property is automatically set to be the name of the script that generated the error. For user-defined errors, the Err.Source property can be set to any valid String expression indicating the source of the error. If the Err.Source property is not explicitly set for user-defined errors, the BasicScript sets the value to be the name of the script in which the error was generated.
Example

                           'The following script generates an error, setting the source
                           'to the specific location where the error was generated.
                           Function InputInteger(Prompt,Optional Title,Optional Def)
                           On Error Resume Next
                             Dim x As Integer
                             x = InputBox(Prompt,Title,Def)
                             If Err.Number Then
    Err.Source = "InputInteger"
    Err.Description = "Integer value expected"
                             InputInteger = Null
                               Err.Raise 3000
                             End If
                             InputInteger = x
                            End Function
                           Sub Main
                             On Error Resume Next
                             x = InputInteger("Enter a number:")
                             If Err.Number Then MsgBox Err.Source & ":" & Err.Description
                           End Sub
                        
See Also Error Handling (topic), Err.Clear (method), Err.HelpContext (property), Err.Description (property), Err.HelpFile (property), Err.Number (property), Err.LastDLLError (property)