Results 1 to 11 of 11
  1. #1
    Azri1
    Guest

    customize your status bar..

    how can we display greetings at status bar
    such as " Welcome and enjoy this program "
    every time we open the file and the greeting
    will remains at the status bar moving like
    in a web browser. thanks

  2. #2
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Kortrijk, Belgium
    Posts
    571
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: customize your status bar..

    You can use

    Application.StatusBar = "Welcome and enjoy this program"

    and put it in the Workbook_Open event of your workbook.
    In the Workbook_Close event, you should add

    Application.StatusBar = False

    to give the control back to Excel.

    I don't know how to make it moving, unless you let it move for a few seconds and then stop it, like in the code below. I have seen some code to cause a delay, maybe this can be used instead of the for next loops. However, I could not find it back.

    Private Sub Workbook_BeforeClose(Cancel As Boolean)
    Application.StatusBar = False
    End Sub

    Private Sub Workbook_Open()
    Dim MyGreeting As String
    Dim i As Integer, j As Integer, k As Integer
    MyGreeting = " Welcome and enjoy this program"
    For i = 1 To 40
    Application.StatusBar = MyGreeting
    MyGreeting = Right$(MyGreeting, Len(MyGreeting) - 1)
    For j = 1 To 10000
    For k = 1 To 20
    Next k
    Next j
    Next i
    End Sub

  3. #3
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Kortrijk, Belgium
    Posts
    571
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: customize your status bar..

    In my original macro, the first 40 characters in the MyGreetings string were spaces. I think Woody ate them...

  4. #4
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: customize your status bar..

    Rather than use the delay loops, you could schedule an OnTime event to move the text, and keep it going the whole time the program is running.
    Legare Coleman

  5. #5
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Kortrijk, Belgium
    Posts
    571
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: customize your status bar..

    This sounds interesting, Legare. Can you be more specific? I know how to start a procedure with the ontime event, but to keep it going the whole time, without occupying the system, ... ??

  6. #6
    Azri1
    Guest

    Re: customize your status bar..

    thanks Hans.but I get an error. I don't know why.
    FYI, I'm using Excel 87.plz refer to my attachment
    Many thanks

  7. #7
    Azri1
    Guest

    Re: customize your status bar..My excel version is

    EXCEL 97..silly me.bye

  8. #8
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: customize your status bar..

    In an initilization procedure, like the Workbook Open event, you display your initial message in the status bar. Then set an OnTime event to execute a routine in some period of time, say one second. When the OnTime procedure executes, you just update the status line, and schedule a new OnTime event to execute the same procedure again in one second. When you want the updating to stop, you just cancel th last OnTime event that you scheduled.
    Legare Coleman

  9. #9
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: customize your status bar..

    The following code will cause a message to scroll across the status bar the entire time that the workbook is open:

    Put this code in the Workbook Open event procedure in the module behind the Workbook object:

    <pre>Private Sub Workbook_Open()
    Application.OnTime Now() + TimeValue("00:00:02"), "DisplayStatusLine"
    End Sub
    </pre>


    Put this code in a general module. Note that the Dim statement for strStatusMsg must be outside all procedures.

    <pre>Dim strStatusMsg As String
    Public Sub DisplayStatusLine()
    If strStatusMsg = "" Then
    strStatusMsg = Space(50) & "Program running"
    End If
    Application.StatusBar = strStatusMsg
    strStatusMsg = Right$(strStatusMsg, Len(strStatusMsg) - 1)
    Application.OnTime Now() + TimeValue("0:00:01"), "DisplayStatusLine"
    End Sub
    </pre>

    Legare Coleman

  10. #10
    Azri1
    Guest

    Re: customize your status bar..

    It works like a charm Mr Coleman..many thanks.regards

  11. #11
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Kortrijk, Belgium
    Posts
    571
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: customize your status bar..

    Thanks Legare, easy and effective!!

Posting Permissions

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