StatusBar command behaves differently in template?

T

Top Spin

The StatusBar command

StatusBar = "Hello, World!"

will put a message on the Word status bar from a VBA macro.

This command seems to work differently when used it in a template
document. It seems to "freeze" Word or at least put it in some "state"
until the status bar is rewritten.

A simplified versiohn of the macro is as follows:

'===============================================
' Increase the paragraph Space Before setting by 6 pts (+6).
'===============================================
Sub TestInc()
Dim nSpBefOld As Single
Dim nSpBefNew As Single

nSpBefOld = Selection.ParagraphFormat.SpaceBefore
nSpBefNew = nSpBefOld + 6
Selection.ParagraphFormat.SpaceBefore = nSpBefNew

StatusBar = "SpaceBefore = " & Selection.ParagraphFormat.SpaceBefore

End Sub
'===================================================

The macro is assigned to Ctrl+{.

I have been using it for some time without a problem. This afternoon,
I tried it in a template (.dot) document. The macro still works, but I
have to hit the shortcut keys (Ctrl+{) twice for every increment.

The first invocation, increases the sopacing by 6 points and puts the
message in the status bar. If I do it again without doing anything
else (even moving the curser) in between, all that happens is that the
macro message in the status bar is replaced with the standard Word
status information. Then the macro will work again.

If I do anything else, even move the curser, so that the macro message
is cleared, the macro will work again.

The macro works every time in dozens of other non-template documents.
It even works in some template documents.

If I comment out the "StatusBar =" code, the macro works every time is
all documents.

Is there something about templates that cause this to work
differently?

What can I check in the document that might cause this?

Thanks

--
Running Word 2K SP-3 (9.0.6926)
PC: HP Omnibook 6000
OS: Win 2K SP-4 (5.00.2195)
Email: Usenet-20031220 at spamex.com
(11/03/04)
 
C

Cindy M -WordMVP-

Hi Top,
I have been using it for some time without a problem. This afternoon,
I tried it in a template (.dot) document. The macro still works, but I
have to hit the shortcut keys (Ctrl+{) twice for every increment.
FWIW, I can't duplicate the problem you describe.

BTW, you'd have probably gotten a quicker response if you'd posted in
one of the word.vba newsgroups.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :)
 

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