Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2005

Tip: Looking for answers? Try searching our database.

VB Buttons

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
LW_Greeney - 19 Oct 2005 14:20 GMT
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
Jonathan West - 19 Oct 2005 15:14 GMT
> Hiya guys....
>
[quoted text clipped - 5 lines]
>
> 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

Signature

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 

Marc Cowlin - 14 Nov 2005 12:59 GMT
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

> > Hiya guys....
> >
[quoted text clipped - 9 lines]
> it
> http://www.word.mvps.org/FAQs/TblsFldsFms/HidePrintButton.htm
Jonathan West - 14 Nov 2005 13:35 GMT
> Jonathan,
>
[quoted text clipped - 6 lines]
> (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

Signature

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 

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.