When returning a user-defined error from an object, set Err.Number by adding the number you selected as an error code to the ObjectError constant. For example, you use the following code to return the number 1051 as an error code:
Err.Raise Number := ObjectError + 1051, Source:= "SomeClass"
Description Property | Err Object | HelpContext Property | HelpContextID Property (VBA Add-In Object Model) | HelpFile Property | LastDLLError Property | Source PropertyApplies To: Err Object | WebClassError Object