Consulting

Results 1 to 20 of 34

Thread: vbObjectError Not Working as Expected

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #21
    Quote Originally Posted by Paul_Hossler View Post
    Like I said, I usually just start my errors at 1000 and forget vbObjectError
    It seems there may be native errors in the region you're using, in which case you are overlapping native numbers. See
    https://exceldevelopmentplatform.blo...criptions.html

    'Private Const ERROR_CANTOPEN As Long = 1011 ' The configuration registry key could not be opened.
    'Private Const ERROR_SERVICE_REQUEST_TIMEOUT As Long = 1053 ' The service did not respond to the start or control request in a timely fashion.'Private Const ERROR_INVALID_PIXEL_FORMAT As Long = 2000 ' The pixel format is invalid.
    'Private Const ERROR_BAD_DRIVER As Long = 2001 ' The specified driver is invalid.
    'Private Const ERROR_INVALID_WINDOW_STYLE As Long = 2002 ' The window style or class attribute is invalid for this operation.
    Update: I guess these are Windows errors, not Excel errors. So this might not affect VBA programming.

    Iac, the solution i offered above allows to use native numbers without conflict.


    Quote Originally Posted by Paul_Hossler View Post
    I've never gotten an all-purpose error handler that I liked
    Does this mean your example is a handler that you do, or don't like?

    I suggest that severity is a different kind of information than type, and shouldn't share the same enum as you have:
    Public Enum errCustomNumbers
        errUserCanceled = 1011
        errClickedPause = 1053
        errBad = 2000
        errVeryBad = 2001
        errReallyBad = 2002
    End Enum
    Last edited by johnywhy; 12-06-2021 at 01:55 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •