--
Eric Legault, MCSD
ADAPSYS - http://www.adapsys.ca
"Mike Hollibaugh" <mho...@buehner-fry.com> wrote in message
news:29a701c2b7f9$e69db4b0$8af82ecf@TK2MSFTNGXA03...
"Eric Legault" <ericatwor...@shaw.ca> wrote in message news:#EWFq8NuCHA.640@TK2MSFTNGP12...
This worked (at work) in Office 2000, and Office XP. Can't vouch for
earlier versions of Office. Should also work for other Office apps,
although the only one I've actually tested it in is Word. I use it
to display progress info in another macro that saves all the emails in
my inbox to files. I use characters to convey completion percentages:
"[===+++++++++++++++++] Saving Message 300/2000, 15% Complete"
"[====================] Saving Message 2000/2000, 100% Complete"
You really don't need all these subroutines and global variables. You
can initialize the statusbar in the first macro the user calls, and
then just look it up by name in the CommandBars collection by name,
then look up the control whose caption you want to change by name in
its Controls collection. Example:
CommandBars("myprogressbar").Controls(1).Caption="44% Complete..."
I'll leave all that as an exercise for the programmer. And before you
complain, remember that I DID say it was a kludge.
-Michael Cooper
notmyaddrt...@yahoo.com
(remove the first nine characters to get my email address)
-------------------CUT HERE-------------------------------------------
'Global Declaration of the status display:
Dim myCommandBar As CommandBar, myCommandBarControl As CommandBarControl
'A Subroutine to initialize the status bar:
Sub InitStatus(StatusBarName As String, InitialCaption As String)
'Clean up in case a macro bombed:
RemoveStatus StatusBarName
'Instantiate and initialize the objects:
Set myCommandBar = CommandBars.Add(StatusBarName,msoBarBottom,,True)
'Alternatively, use msoBarFloating to float the bar over the window
Set myCommandBarControl = myCommandBar.Controls.Add(msoControlButton,,,,True)
'For some bizarre reason, msoControlPopup might actually work better-
'On some machines, the msoControlButton won't display a caption.
myCommandBarControl.Caption = InitialCaption
myCommandBarControl.Visible = True
myCommandBar.Visible = True
End Sub
'Subroutine to get rid of the status bar:
Sub RemoveStatus(StatusBarName As String)
'Multiple CommandBars can share the same name, so get rid of previous
For i = CommandBars.Count To 1 Step -1
If CommandBars(i).Name = StatusBarName Then
CommandBars(i).Delete
End If
Next i
End Sub
'Subroutine to set the status bar caption:
Sub SetStatus(inCaption As String)
myCommandBarControl.Caption = inCaption
End Sub
'Some macros that can be called to
Sub showexample()
InitStatus "my progress bar", "this is my progressbar"
End Sub
Sub showexample2()
SetStatus "my new status is..."
End Sub
Sub cleanupexample()
RemoveStatus "my progress bar"
End Sub
-------------------CUT HERE-------------------------------------------
On Fri, 10 Jan 2003 13:29:57 -0600, "Eric Legault" <ericatwor...@shaw.ca>
wrote:
--
Eric Legault, MCSD
ADAPSYS - http://www.adapsys.ca
"Michael Cooper" <notmyaddrt...@yahoo.com> wrote in message
news:h5cb5v8nimkpfpob5...@4ax.com...