LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 229
Default "Waiting Message"

On Nov 27, 5:11 pm, Guinness
wrote:
I was wondering how to activate a waiting message to pop up while one of my
longer macros is running, so that the users do not think the program froze. I
was given one VBA code, but I couldnt get it to work. Thank you.


If your macro runs long, one solution could be to simply update the
status bar every so often. For instance, let's say I have a For loop
that populates some cells, etc. In this case, I have DoEvents, just
for sake of making this seem slow:

Public Sub statusBarUpdate()
Dim i As Long
Const lastItem As Long = 1000000

For i = 1 To lastItem
' whatever you're doing
DoEvents

' update status bar every 1 percent
If (i Mod (lastItem \ 100)) = 0 Then
Application.StatusBar = "Processing " & _
Int(100 * i / lastItem) & "% complete"
End If
Next i

' reset status bar
Application.StatusBar = False
End Sub

If you have multiple loops in your macro, consider giving them
different names. Connecting, Waiting, Processing, Analyzing,
Compiling, Preparing Report - just to keep users a little engaged - or
even display something more meaningful than just the % completion
(name of item being processed, file name like installer programs do,
or whatever your scenario is). The trick is to do the update
infrequently, so as not to slow down the operation by much.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM
can i get the "message pane" underneath the "threads pane" instea Rich Mcc Excel Worksheet Functions 2 March 3rd 06 10:18 AM
Complex if test program possible? If "value" "value", paste "value" in another cell? jseabold Excel Discussion (Misc queries) 1 January 30th 06 10:01 PM


All times are GMT +1. The time now is 01:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"