Consulting

Results 1 to 20 of 34

Thread: vbObjectError Not Working as Expected

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    vbObjectError Not Working as Expected

    This page:
    https://bettersolutions.com/vba/erro...ing-errors.htm

    says:
    "If you are generating errors, then you should add your number to the vbObjectError constant. Eg Err.Raise Number = vbObjectError + 1000
    The range 513 - 65535 is available for user defined errors"
    Ok, but i did, and got a native error:

    Err.Raise vbObjectError+515
    Automation error
    A syntax error occurred trying to evaluate a query string
    This site
    https://exceldevelopmentplatform.blo...criptions.html

    says the error code for that error-message is
    EVENT_E_QUERYSYNTAX As Long = &H80040203
    The VBA immediate pane confirms this:
    ?&H80040203
    -2147220989
    If i'm supposed to add vbObjectError, and if 513-65535 is usable, then why does `Err.Raise vbObjectError+515` give me a native error!?

    bettersolutions.com also says:
    "The range 513 - 65535 is available for user defined errors"
    Ok, let's say they mean my custom codes should start at 513, and forget about vbObjectError.

    But their Codes page shows native errors of 520, 521, some 700's, and some 31000's.
    https://bettersolutions.com/vba/erro...rror-codes.htm

    also O'Reilly says:
    "we are left with numbers in the range vbObjectError + 512 to vbObjectError + 65535"
    https://www.oreilly.com/library/view...0/ch09s04.html

    So i'm totally confused.

    Thx!

    also asked here
    https://www.excelforum.com/excel-pro...ml#post5574397
    Last edited by johnywhy; 09-28-2021 at 07: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
  •