Consulting

Results 1 to 20 of 34

Thread: vbObjectError Not Working as Expected

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #24
    My solution does work, but i still have to add vbObjectError to my custom errors!

    For some reason, my prior example of 11 and 53 worked ok, but passing 0 as error number fails. The raised error is lost, and a new Automation Error occurs:

    Err.Raise 0, "Custom"
    So, VB won't allow me to overlap native numbers (or certain ones, i guess), even if i specify source. Starting my numbering at vbObjectError works.

    Enum CustomError
              UserCancel = vbObjectError
              UserPause
              ProtectedWorkbook
              CorruptWorkbook
              ShellError
    End Enum
    Since vbObjectError = -2147221504 , that means my numbering will start at -2147221504 and go up from there. No, i'm wrong, it's not a negative number, it's unsigned, i'm told. Somehow, -2147221504 = 513???

    Using "Custom" as error-source to disambiguate the custom error number from native numbers maybe not even needed. Or rather, may be used to differentiate between different types of custom errors, but my custom numbers still can't overlap the native ones.

    It seems it would have been better if VB allowed every app to define it's own error numbers (even overlapping ones) with a .Source disambiguator, but what do i know.
    Last edited by johnywhy; 12-07-2021 at 10:38 AM.

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
  •