Chip has a good overview

http://www.cpearson.com/Excel/ErrorHandling.htm


https://bettersolutions.com/vba/error-handling/raising-errors.htm


has examples showing application vs automation error codes

Like you said
Long, identifying the type of the error. Visual Basic errors range from 0 to 65535
The range 0 - 512 is reserved for system errors
The range 513 - 65535 is available for user defined errors

You add vbObjectError (probably a bad name) to your error so that they don't get tangled up

According to

https://docs.microsoft.com/en-us/off...r-applications

The first example illustrates a typical use of the Number property in an error-handling routine. The second example examines the Number property of the Err object to determine whether an error returned by an Automation object was defined by the object, or whether it was mapped to an error defined by Visual Basic.Note that the constant vbObjectError is a very large negative number that an object adds to its own error code to indicate that the error is defined by the server. Therefore, subtracting it from Err.Number strips it out of the result.
If the error is object-defined, the base number is left in MyError, which is displayed in a message box along with the original source of the error. If Err.Number represents a Visual Basic error, the Visual Basic error number is displayed in the message box.

Here's an example that I hope will explain what I mean

There's 2 Error 11's, one by the macro and one by the system (probably as very bad idea to overlap like that)

There's also what I would consider a more realistic example returning error number = 1000

Option Explicit


Sub TestEntry()
    Dim MyErr As Long
        
    On Error GoTo HANDLER
    
    TestErr     '   Raises my error 11
    
    TestZero    '   Raises system error 11
    
    TestErr2    '   My normal way to raise error condition


    Exit Sub




HANDLER:
    ' First, strip off the constant added by the object to indicate one of its own errors.
    MyErr = Err.Number - vbObjectError


    'If you subtract the vbObjectError constant, and the number is still
    ' in the range 0-65,535, it is an object-defined error code.
    If MyErr > 0 And MyErr < 65535 Then
        Select Case MyErr
            Case 11
                MsgBox "You should leave system error numbers alone"
            Case 1000
                MsgBox MyErr & " -- " & Err.Source & " -- " & Err.Description
            Case Else
                MsgBox "Something happened"
        End Select

    ' Otherwise it is a Visual Basic error number.
    Else
        MsgBox Err.Number & " -- " & Err.Source & " -- " & Err.Description
    End If
    
    Resume Next
End Sub

Sub TestErr()
    Err.Raise vbObjectError + 11, "TestErr", "This is My Error"
End Sub

Sub TestZero()
    Dim x As Long
    x = 1 / 0
End Sub

Sub TestErr2()
    Err.Raise vbObjectError + 1000, "TestErr2", "You did SOMETHING wrong, so go back and fix it!!!"
End Sub