Command Button - No Print

G

Graham Mayor

Two comments:

1. The link to the MVPS web site is an old one and the method used there no
longer appears to work (not even from the downloadable template) with recent
Word versions. In any case the code would have to be run from intercepting
the print command and not from the button as shown in the example.

2. The simplest solution would be to remove your button from the document
and run the code from a conventional toolbar button.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
K

Karin

Thank you, Graham. I reached that conclusion myself and then posted another
request for help to get the toolbar to load on open.

I have this in the Auto Open of a document
CommandBars("NFP").Visible = True
It pops up and then disappears.

The macro and the toolbar are attached to the document (not to normal.dot).

The macro is basically changes various verbiage throughout the document.

It will be used throughout the company on a national basis and I have no
clue what level the users will be at. I need them to see the toolbar when
they open the document so that it is obvious.

Any suggestions?
 
G

Graham Mayor

Funnily enough I had a similar problem yesterday with a document template I
was working on, and then today after a restart, the same command worked as
it should. To reinforce the issue I changed the line to:

If Application.CommandBars(("NFP").Visible = False Then
Application.CommandBars("("NFP"").Visible = True
Else
Application.CommandBars("("NFP"").Visible = True
End If

and have had no further problems. Note that if the toolbar is floating and
displayed when you save and close the document, it should be displayed
anyway when the document is opened.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
K

Karin

Hi, Graham,

Thank you for responding. I copied that code and get a compile error:
expected list separator or )

I should mention that I am working with Word 2003, VB 6.5
 
K

Karin

When I change the If statement to be

If Application.CommandBars("NFP").Visible = False Then
Application.CommandBars("NFP").Visible = True
Else
Application.CommandBars("NFP").Visible = True
End If

I do not get an error, but I still don't get a toolbar. (It shows up until
I close Word and when I relaunch it does it's disappearing act.)

Could it have something to do with templates? This is not a .dot file, just
a .doc file, and there are reasons why it should not be a .dot file.

TIA
 
G

Graham Mayor

Try losing the macro altogether.
Display the toolbar as a floating toolbar in the text space
Save and close the document
The toolbar should display when the document is opened.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
M

MLBeck

You might try putting the button on a toolbar.

Tools/Customize/Commands/Macro. Then drag the macro to a toolbar.
 
K

Karin

Graham, thank you for your continued assistance.

ARGH! I'm so frustrated! :) Nothing works. It pops up and then
disappears. It will hang out when I open and then close and then open the
document, but exit Word and poof it's back to the disappearing act.
 
K

Karin

I close Word and then launch it with the document, I get the toolbar
disappearing act.

I close Word and then launch it with the icon in the taskbar (not any
document), then I open the file that has the toolbar and I get the toolbar.
No disappearing act. I'm guessing it has something to do with the way
Normal.dot is launched. So if no one opens the document directly, it should
work. But still, I wish it worked all the time!
 

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