VB Command Button Question

T

TomP

I've been having problems hiding and showing the command button in MS Word.
When the button is pressed it will bring up a form. The form has another
command "OK & CANCEL" and also "Input Field".

I was able to reduce the size of the Command Button to .0001 for printing,
but not able to bring it back to the original size after the document is
printed. (See Below)

Question: How can have the CommandButton1 show again without closing the
document and opening it again?

With ActiveDocument.CommandButton1
.Height = 0.0001
.Width = 0.0001
End With

MsgBox "Your document is now being printed..."

ActiveDocument.PrintOut

With ActiveDocument.CommandButton1
.Height = 25
.Width = 160
End With

Exit Sub

End Sub

Thank you for your help!

Tom
 
J

Jay Freedman

See http://www.word.mvps.org/FAQs/TblsFldsFms/HidePrintButton.htm for a
method that works.

However, it's a better idea either to put a custom button on a toolbar in
the template that contains the code
(http://www.word.mvps.org/FAQs/Customization/AsgnCmdOrMacroToToolbar.htm) so
that it isn't necessary to hide it, or to write code to intercept the Print
commands as suggested at the bottom of the first article.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 

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