Dynamic Status Bar Routine

E

ExcelMonkey

I normally use status bars with my loops for progress indicators. I
would like to create a separate sub for the status bar and send all my
variables from many loops in my main module to one single status bar
routine.

So if I send the variables to status routine, I can calculate a %
completed stat. But depending on the loop that I am analyzing, I may
want to have different texct associated with the status report.
Example:

25% Completed Loop 1
55% Completed Loop 2
70% Completed Loop 3

My question is, how do I change the text after the calc now that the
status bar is in its own sub? I almost need a Case Stmt within the
statusbar sub that decides what text to use based on where the
variables came from. That is append "Completed Loop 1" if varibles
come from part X of routine etc

Or is it possible to Call the routine and append the text to the call
statement?

Call StatusBar & "Completed Loop 1"
 
B

Bob Phillips

Why not pass that part as a argument?

For instance,

Sub DisplayStatusBar(pct As Long, text As String)
Dim sText As String

sText = Format(pct,"0%") & " Completed " & text


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
T

Tom Ogilvy

Sub WriteToStatusBar( sStr as String, sStr1 as String)
application.StatusBar = sStr & " Completed " & sStr1
End Sub



in another routine
WriteToStatusBar "25%", "1"

or
Dim sV1 as String, sV2 as String
sV1 = "25%"
sV2 = "1"

WriteToStatusBar sV1, sV2
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top