Results 1 to 5 of 5
  1. #1
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Clearing the statusbar (word97/sr2)

    Despite the fact that the Help files say that the status bar is write-only (why???!!) I wanted to return a string whenever I've set the status bar, so I do.

    I tested the function with a little MsgBox from a TEST routine and surprise surprise! The MsgBox appears to clear the status bar.

    Why????


    If I comment out the second MsgBox call (the third call to strStatusBar), the string "hello2" is left visible in the status bar. That second MsgBox call appears to clear the status bar, but I can find no reference to this in the Help Files for MsgBox.


    <pre>Public Function strStatusBar(str1 As String) As String
    Application.StatusBar = str1
    strStatusBar = str1
    End Function

    Sub TESTstrStatusBar()
    MsgBox strStatusBar("hello1")
    Call strStatusBar("hello2")
    MsgBox strStatusBar("hello3")
    End Sub

    </pre>


  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Clearing the statusbar (word97/sr2)

    Chris,

    You normally clear the statusbar by passing it an empty string. The string you're returning only tells you that you attempted to set the statusbar to that value. It doesn't tell you it actually happened.

    I see no reason for your second MsgBox expression to clear the statusbar. Are you saying that you *Don't* see "hello3" in the statusbar after that? What do you see instead?
    Charlotte

  3. #3
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Clearing the statusbar (word97/sr2)

    Chris,

    If you run your code whilst the documemt window is active, the status bar is not cleared until you dismiss the message box. The same applies if you use a userform, or if you activate any other window and the return..

    It seems that activatting the window that owns the status bar re-setes the status bar.

    This happens when you return focus from the message box.

    Andrew C

  4. #4
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Clearing the statusbar (word97/sr2)

    > only tells you that you attempted to set the statusbar

    Well, it also allows me to use a pass-through value - I can embed a call to strStatusBar in an expression, and the string argument passes right through the function and is available on the other side:
    <pre> MsgBox "There is a problem with " & strStatusBar (strMyName)
    </pre>




    >I see no reason for your second MsgBox expression to clear the statusbar

    Me neither. That's the puzzle.

    Without the 2nd MsgBox in place, I end up with "hello2" in the status bar.
    With the 2nd MsgBox in place, I end up with an empty status bar.


    > Are you saying that you *Don't* see "hello3" in the statusbar after that?

    Yes, that's correct. MsgBox seems to clear the status bar.

  5. #5
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Clearing the statusbar (word97/sr2)

    Andrew, thanks for the push back to the experimental lab (grin)

    > the status bar is not cleared until you dismiss the message box

    True. I re-ran my macro from Word, rather than single-stepping from a VBE window. The status text is there until I click "OK" on the MsgBox GUI.



    >activating the window that owns the status bar re-sets the status bar.

    True. This annoys me. I'd like to think that the status bar contains useful (to the user) information, and we should allow the user to Alt-Tab to another Window to check something, and then Alt-tab back to Word to re-examine the status bar emssage. (Isn't that why we have windows?)

    My experiment running the macro from the Word window shows me that Alt-Tab back to Word obliterates the status bar message.

    Aaaaaaaaaaaaaaaaaaaaargh!

Posting Permissions

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