Returns or sets the name of the object or application which generated the error originally. The Source property indicates a string expression which is usually the class name or programmatic ID of the object which caused the error. Use Source to present your users with information while your code is unable to handle an error generated into an accessed object. For instance, if you access Microsoft Excel & it generates a Division through zero error, Microsoft Excel sets the VBScript Err Object Number Property to its error code for that error & sets Source to Excel application. Note that if the error is generated into another object called through Microsoft Excel, Excel intercepts the error & sets Err.Number to its own code for Division through zero. Though, it leaves the other Err object (by including Source) as set by the object which generated the error.
Source always have the name of the object which originally generated the error - your code can attempt to handle the error according to the error documentation of the object you accessed. If you fail in error handler, you can employ the Err object information to define the error to your user, by using Source and the other Err to inform the user that object caused the error originally, a description of the error, and so forth.
Syntax
|
Err.Source [= stringexpression]
|
Argument :
stringexpression
|
A string expression representing the application which generated the error.
|