+ Reply to Thread
Results 1 to 3 of 3

Resume Next not working

Hybrid View

  1. #1
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Resume Next not working

    I have this code that just "Resets" with no error. It has worked fine for several years, but now it "Resets" when the variable is empty.
    Function RunProc(sProc2Run as String) as Boolean
        Dim bOK as boolean
    
        bOK = True
        On Error Resume Next
        bOK = Run(sProc2Run)         'sProc2Run does not exist in this example
        On Error GoTo HE             'never gets here
        '.... more code
    HE:
        '.... error trapping
        RunProc = True
    End Function
    I step through the code 1 line at a time (F8). It gets to the indicated line, and then when I click F8 nothing happens, and no line is highlighted as if I had clicked "Reset" instead of F8.

    I use this function all the time and it works fine as long as sProc2Run exists, and it has always worked fine when sProc2Run doesn't exist. But today it stopped when sProc2Run doesn't exist.
    Is there some setting or environment or anything that could have stopped it working?
    Foxguy

    Remember to mark your questions [Solved] and rate the answer(s)
    Forum Rules are Here

  2. #2
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Resume Next not working

    Function RunProc(sProc2Run as String) as Boolean
        On Error Resume Next
        Run(sProc2Run)
        On Error GoTo HE             'never gets here
        '.... more code
    HE:
        '.... error trapping
        RunProc = err.number=0
    End Function
    or
    Function RunProc(sProc2Run as String) as Boolean
        On Error GoTo HE
        if sProc2Run<>"" then Run(sProc2Run)
        '.... more code
    HE:
        '.... error trapping
        RunProc = err.number=0
    End Function



  3. #3
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: Resume Next not working

    snb;

    There is no error in my code. It has worked for years.

    I'm just trying to find out if someone knows of some reason why it would quit working.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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