+ Reply to Thread
Results 1 to 2 of 2

Frozen Status Bar upon Errors

  1. #1
    ExcelMonkey
    Guest

    Frozen Status Bar upon Errors

    I have a procedure that uses the

    Application.StatusBar to update the user on the progress
    of the routine. As the procedure does not have all the
    error handling that it needs, the procedure is failing
    every now and then. When it fails, the status bar freezes
    with the last value that was in it.

    Is there a way to say in the event of any type of error
    clear the status bar. I am assuming it would look like

    On Error
    Application.StatusBar = ""

    But I am not sure where to put this in my code as I have a
    for Each Loop that calls various procedures. I need to
    put it in part of the code that will always ensure that I
    do not have values in my status bar upon error generation.

  2. #2
    Jim Rech
    Guest

    Re: Frozen Status Bar upon Errors

    You can set a "general error handler" in your main sub and if there is no
    error handler set at a given point of execution, error handling will fall
    through to it:

    Sub Main()
    On Error GoTo GeneralHandler
    Call Sub1
    Exit Sub
    GeneralHandler:
    MsgBox "in general error handler"
    End Sub

    Sub Sub1()
    Dim x As Integer
    Call Sub2
    x = "abc" 'will be caught in Main error handler
    End Sub

    Sub Sub2()
    Dim x As Integer
    On Error GoTo Sub3Handler
    x = "abc"
    Exit Sub
    Sub3Handler:
    MsgBox "in sub3 handler"
    End Sub


    --
    Jim Rech
    Excel MVP
    "ExcelMonkey" <[email protected]> wrote in message
    news:[email protected]...
    |I have a procedure that uses the
    |
    | Application.StatusBar to update the user on the progress
    | of the routine. As the procedure does not have all the
    | error handling that it needs, the procedure is failing
    | every now and then. When it fails, the status bar freezes
    | with the last value that was in it.
    |
    | Is there a way to say in the event of any type of error
    | clear the status bar. I am assuming it would look like
    |
    | On Error
    | Application.StatusBar = ""
    |
    | But I am not sure where to put this in my code as I have a
    | for Each Loop that calls various procedures. I need to
    | put it in part of the code that will always ensure that I
    | do not have values in my status bar upon error generation.



+ 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