VB Buttons

L

LW_Greeney

Hiya guys....

I have created a VB Button into my word document which has a macro attached
to it. But when I print the page I dont want to show the button, How can I
change it so the button only sppears in the page and not on the printed
documents?

Alistaire
 
J

Jonathan West

LW_Greeney said:
Hiya guys....

I have created a VB Button into my word document which has a macro
attached
to it. But when I print the page I dont want to show the button, How can I
change it so the button only sppears in the page and not on the printed
documents?

Alistaire

How to hide a Print commandbutton on a document form when a user clicks on
it
http://www.word.mvps.org/FAQs/TblsFldsFms/HidePrintButton.htm


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 
M

Marc Cowlin

Jonathan,

Thanks for that link, it was very useful (i had a similar thread like tihis
elsewhere).

However, is it possible to assign a specific name to the object to prevent
any confusion if a user inserts another object, as this will mean that
(depending upon location of the new object) it may be the item that is
temporarily hidden instead of trhe form button.

Thanks
 
J

Jonathan West

Marc Cowlin said:
Jonathan,

Thanks for that link, it was very useful (i had a similar thread like
tihis
elsewhere).

However, is it possible to assign a specific name to the object to prevent
any confusion if a user inserts another object, as this will mean that
(depending upon location of the new object) it may be the item that is
temporarily hidden instead of trhe form button.

Right-click on the shape, select Format Picture from the pop-up menu. select
the Web tab. You can type some text into the Alternative text box, something
like "hide me"

Then the code can be updated like this

Private Sub CommandButton1_Click()
Dim oShape as Shape

For Each oShape in ActiveDocument.Shapes
If oShape.AlternativeText = "hide me" Then
oShape.Visible = msoFalse
End If
Next oShape
ActiveDocument.PrintOut Background:=False

For Each oShape in ActiveDocument.Shapes
If oShape.AlternativeText = "hide me" Then
oShape.Visible = msoTrue
End If
Next oShape

End Sub


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 

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