PDA

View Full Version : Update Status Bar or Status Bar Alternative



rruckus
03-08-2011, 10:43 AM
I want to be able to show a message to the user in my Word template that is constantly on the screen (not a msgbox or dialog) and can be updated from VBA when I want. My first thought was to use the status bar:

Application.StatusBar = "My Message"

But that only works for a second because as soon as the user does anything, My Message is replaced by Word's status bar (shows page count, line, word count, etc). I need my message to show until I DECIDE to change it again.

1) Is this possible with the StatusBar?
2) If not, what other object can I use?
3) Is it possible to create my own label on the Ribbon that I can update? How?
4) Is it possible to create my own label on the Status bar that I can update?

I'm using Word 2007 & 2010 so it needs to work in those versions of Word. A modeless dialog isn't a viable option unless it can be docked nicely out of the way somewhere.

Thanks!!!

Frosty
03-08-2011, 12:38 PM
Why do you want this functionality? The answer to that will help answer your question, since this is sort of a brainstorming issue. These are (and there may be something I'm missing) the main ways of communicating with your user:

1. Status bar
2. Messagebox
3. modeless userform
4. task pane
5. application bar
6. a custom "big" button on one or more of your tabs (which you could refresh by invalidating the control during different events-- this is a real spit ball idea, as I think the overhead wouldn't be worth it).

But you sort of have to define when you'd want to change the information (events? Running specific code?) to give you a more targetted answer.

I haven't played with task panes... but those can operate in a docked mode. However, I think you'd need to write compiled add-in to get that fully working.

The application title bar may work (I've used that to give a user more info than "Document 1" before a document is saved), although that would be based on whichever document you had active (although you could update it on a document change event, taking the existing title -- which is typically the document name -- and updating something at the end of it to update your user).

How about some more info about why and when you want this functionality.

rruckus
03-08-2011, 01:29 PM
Ok, here's why:

I have a bunch of Content Controls in my document that define different parts of the document and users need to know what part they are in (headings aren't enough). Word normally handles this nicely by showing the blue Title tab. This would be a great solution for me, but in my case, the Content Controls need to be locked so users can't edit them. When they are locked, the Title tabs don't show up! So I wanted to use the content control Enter event to update the status bar (or whatever else I can use) to show the user what Content Control they are in. Maybe I just need to use a modeless form and tuck it away in the corner somehwere. Task panes would be cool, but I can't do it in VBA. So there's no way to customize the status bar more???

fumei
03-08-2011, 01:35 PM
Not the way you seem to be wanting.

Frosty
03-08-2011, 01:45 PM
I haven't played with content controls... but why don't you try (just as a proof of concept) something along the following:

Public Sub UpdateMyActiveWindowCaption(sWhatInfo As String)
Dim sCaption As String
Dim i As Integer
sCaption = ActiveWindow.Caption
i = InStr(sCaption, "**[")
'see if we've already got our brackets there
If i <> 0 Then
'trim it if so
sCaption = Left(sCaption, i - 2)
End If
'update the caption
ActiveWindow.Caption = sCaption & " **[" & sWhatInfo & "]**"
End Sub

fumei
03-08-2011, 02:08 PM
I'm going to miss this place.

rruckus
03-08-2011, 02:30 PM
Yah I can use the Window Caption but it's pretty ugly IMHO. If you haven't used Content Controls you should - they are very useful. It's just too bad VBA (or the user) can't set an option to "Always Show Content Control Titles" or similar. I don't know why Word assumes that they know when to show the title. It should be a view option. And there should really be a way to add your own column to the status bar, maybe like the Ribbon XML custom UI file.

Fumei !!! Sad to see you go.

Frosty
03-08-2011, 02:55 PM
I agree that the window caption is ugly... but at least it works.

You sound like an experienced coder. I'm not sure why you're surprised there are user interface (and coder interface) issues with something as new as content controls when combined with something which has always been as problematic as protected documents. Grin.