+ Reply to Thread
Results 1 to 4 of 4

Error doesn't get caught

  1. #1
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Error doesn't get caught

    Hi all,

    I have the code below - it doesn't catch an error when there is one (when I remove "on error resume next", the SET T2 = errors with an "Run-Time error 91: Object variable or With block variable not set". - In my experience this should still change the err.description or number, but just not stop the code.
    Why doesn't the Err.description or .number change when it's within the 'resume next' statement?

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Error doesn't get caught

    On error resume next will indeed still register the error but not stop code. However, on error goto 0 will reset that error object.
    Perhaps try:

    Please Login or Register  to view this content.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: Error doesn't get caught

    Very interesting, I wasn't aware that setting it back to 'On Error GoTo 0' resets the error description/number. Thanks for the explanation.

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Error doesn't get caught

    Graag gedaan!

    Glad I could help out Thanks for the feedback and rep!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 10
    Last Post: 06-20-2013, 02:24 PM
  2. [SOLVED] Refresh Pivot - caught in a loop
    By jomili in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-18-2011, 09:42 AM
  3. Macro getting caught in loop
    By HuskerBronco in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-13-2009, 03:14 PM
  4. Excel caught looping script
    By realniceguy5000 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-12-2008, 02:55 PM
  5. What to say if you're caught asleep at your desk
    By Trebor76 in forum The Water Cooler
    Replies: 1
    Last Post: 07-25-2008, 03:32 AM
  6. Caught in an Infinite Loop
    By mgri in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-02-2007, 10:14 AM
  7. Error Handling - On Error GoTo doesn't trap error successfully
    By David in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-16-2006, 02:10 PM
  8. [SOLVED] On Error doesn't trap Application.Run error
    By blackhawk in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-04-2005, 12:06 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1