Consulting

Results 1 to 6 of 6

Thread: Solved: Message while running macros

  1. #1
    VBAX Regular
    Joined
    Aug 2009
    Posts
    21
    Location

    Question Solved: Message while running macros

    Hello,

    I'm currently running a macro in Excel that take a few minutes to do (goes through multiple worksheets and also gets info from 3 different files.

    The macro runs great but since it's taking a little bit of time to complete, I would like to have a message show up saying to "Please Wait" while the macro is running and another message "All done" once the macro is completed...

    Thanks in advance for anyone able to help me out...

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    You can show a message in the Status Bar. From the Help file
    StatusBar Property Example
    This example sets the status bar text to "Please be patient..." before it opens the workbook Large.xls, and then it restores the default text.
    [vba]oldStatusBar = Application.DisplayStatusBar
    Application.DisplayStatusBar = True
    Application.StatusBar = "Please be patient..."
    Workbooks.Open Filename:="LARGE.XLS"
    Application.StatusBar = False
    Application.DisplayStatusBar = oldStatusBar[/vba]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    VBAX Regular
    Joined
    Jul 2008
    Posts
    9
    Location
    Mr. mdmackillop,

    In my situation, I set the worksheet visibility to false to speed up processing and get input from a userform. Does the userform have a status bar?
    [VBA]
    Application.Visible = False

    [/VBA]

  4. #4
    Knowledge Base Approver VBAX Guru GTO's Avatar
    Joined
    Sep 2008
    Posts
    3,368
    Location
    Greetings Dadmin,

    The status bar is at the bottom of Excel's window, not in a userform. If you have the userform displayed (or want to make another userform to display) during calculations/runtime while the macro runs, you might want to take a look at this vbaexpress KB entry:

    http://www.vbaexpress.com/kb/getarticle.php?kb_id=169

    Mark

  5. #5
    VBAX Regular
    Joined
    Jul 2008
    Posts
    9
    Location
    Thanks, GTO. That looks like it'll work for me. I'm just bummed that VBA doesn't allow MsgBox to be one-way with a Null feedback. In the good old days of DOS, you could simulate hitting the Enter key and redirect it to a command line in a batch file.

  6. #6
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

Posting Permissions

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