PDA

View Full Version : statusbar and new panel



island17
07-30-2007, 12:41 PM
I'm trying to add a new panel to the statusbar. I need to add some code to the end of a macro to display new values in the statusbar.

any ideas

many thanks
Russ

fumei
07-30-2007, 01:24 PM
"add a new panel to the statusbar"

"display new values in the statusbar"

These are different. Which are you trying to do? I don't know of a way to add a new panel, if by that you mean a new area.

island17
07-30-2007, 01:57 PM
I did want to create a new area on the Statusbar for new information.
But it doens't need to be on the statusbar if something else would work. I need to display a value after the user runs a macro. This value information needs to remain visible until the user runs the macro again.

It could be a button name on a toolbar, if that can be done.

fionabolt
07-31-2007, 01:32 AM
Russ

To display something on the existing status bar would just be this:

If Application.DisplayStatusBar = False Then _
Application.DisplayStatusBar = True

StatusBar = "The information you want to display here"

However, to make it visible when you run another macro, you would have to save the information somewhere to the document. eg. a document variable, so that the new macro could obtain the information and run the code above again.

Why do you want this information to still be visible when you run the next macro? I assume you are wanting to display some values that the user can then input into a dialog in the new macro? Why not store the values, as suggested above, and populate the dialog in the new macro?

In case you go down this route, here's the code to save a value as a document variable:

Sub MainRoutine
SetDocVar "VariableName", "Value"
End Sub

Sub SetDocVar(ByVal sName As String, ByVal sValue As String)

On Error GoTo SetDocVar_EH
ActiveDocument.Variables.Add Name:=sName, Value:=sValue

Exit Sub
SetDocVar_EH:
Select Case Err.Number
Case 5903 'Variable already exists just set the value
ActiveDocument.Variables(sName).Value = sValue
Case Else
Const strProcedure As String = "PROC:SetDocVar"
MsgBox strProcedure + "ERRORNO:" _
+ Str(Err.Number) + " " + Err.Description, vbCritical, _
"VBA Error"
End Select
End Sub


Regards,

island17
07-31-2007, 11:34 AM
Thanks for your help, and I apologies for not making myself clear.

We have a macro that calculates the length of a file (it is an unusual count, not your normal inch count).
The initial value is displayed in a message box, and disappears when the user clicks the OK button.
What we want to do is to have that value displayed where the user can see it, after they have clicked the OK button.
I think it can be done as a button caption, and that is what I have been working on today.
I hope this clears up what I was requesting. Thanks for your help, Let me know if you think you can help me with this.

Russ