Solved

Word form with Command Button - Don't Show on Print

Posted on 2009-04-01
13
6,479 Views
Last Modified: 2012-05-06
I have a Word 2007 doc with command buttons which I do not want to show when the document is printed.
Is this possible?
Thx,

MV
0
Comment
Question by:Michael Vasilevsky
  • 6
  • 5
  • 2
13 Comments
 
LVL 14

Expert Comment

by:BigBadWolf_000
ID: 24044860
Make sure you are in Design Mode  the Design Mode button on the top-left of the Control Toolbox toolbar needs to be depressed.

Now, double-click on the CommandButton  this will take you into the VBE (Visual Basic Editor) and create a CommandButton_Click event procedure. Paste the following code into this procedure.

Close the VBE, exit out of Design Mode and the CommandButton should not print
Private Sub CommandButton1_Click() 
 

With ActiveDocument 

    .Shapes(1).Visible = msoFalse 

    .PrintOut Background:=False 

    .Shapes(1).Visible = msoTrue 

End With 
 

End Sub

Open in new window

0
 
LVL 14

Expert Comment

by:BigBadWolf_000
ID: 24044878
Oh in Word 2007
Open file make sure macros are enabled
Click on Developer Tab
In ribbion click on Design Mode

0
 
LVL 10

Author Comment

by:Michael Vasilevsky
ID: 24052925
hmm I think you misunderstood, that code prints the document on the Click event. I want to set the "VisibleOnPrint" property of the command button to False so that it doesn't show up when a user manually prints the document. Does the "VisibleOnPrint" property exist in Word?

I know Access has the "Display When (Always, Print Only, Screen Only)" property for form controls. I'm looking for something analogous here, so I can display the command button on the screen only (not on print).
I hope that's clearer.
0
 
LVL 14

Expert Comment

by:BigBadWolf_000
ID: 24053097
The above code....prints the document on the Click event. However, it will not print the button itsself on the print output. Try it on the test file, you will see what I mean.


0
 
LVL 10

Author Comment

by:Michael Vasilevsky
ID: 24053199
It did print the button...
0
 
LVL 14

Expert Comment

by:BigBadWolf_000
ID: 24053560
Make sure this "CommandButton1_Click()" is changes to the appropiate (name) on your button properties. If you do Wors > File > Print it will print the button . If you click on the button it will not print the button. Sorry I cant post my file, site does not allow any xml, zipped or renamed :(

Here are some images...Hope this helps
Snap1.jpg
Snap2.jpg
Snap3.jpg
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 10

Author Comment

by:Michael Vasilevsky
ID: 24053689
Ok I see the code is for a 'Print Document' command button. I don't want to force my users to print from a custom button and don't think I could get them to comply anyway. So there is no command button property like what I'm looking for?
0
 
LVL 14

Expert Comment

by:BigBadWolf_000
ID: 24054820
Ahhhh..I now understand.... I believe in Excel there is the option of changing "print object" (for the command button) to False and then the button does not print when the
worksheet is printed. But in Word, i am not sure.

However, if you place a macro button in the toolbar it should not print. Check out this link on how to...towards the end of the page
http://www.gmayor.com/installing_macro.htm
Hope this helps
0
 
LVL 10

Accepted Solution

by:
Michael Vasilevsky earned 0 total points
ID: 24055106
Here's the answer I was looking for (from http://msdn.microsoft.com/en-us/library/aa140269(office.10).aspx): "Select it while in Design Mode and apply "hidden" font formatting. Make sure the option to print hidden text is disabled (click Print on the Options submenu of the Tools menu). (Note that you will probably still see it in Print Preview, but it should not print.)"

Thx anyway.

MV
0
 
LVL 14

Expert Comment

by:BigBadWolf_000
ID: 24055378
That was too simple. Thanks, I learnt something.
0
 

Expert Comment

by:scarysc
ID: 34264104
dragging up an old thread but how do I apply "hidden"? to the cmd button?
0
 
LVL 10

Author Comment

by:Michael Vasilevsky
ID: 34268316
Word 2007: In design mode right-click on cmd button, select CommandButton Object -> Edit, select all the text, go to the Home tab on the Ribbon, open the Font dialog box, check the Hidden Effect.
HTH,

MV
0
 

Expert Comment

by:scarysc
ID: 34287590
Thankyou!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Like many others, we try and discourage users from printing documents unnecessarily and instead send or share them electronically. However, this doesn't always work and documents are still printed. With this simple solution, if the user tries to …
This article describes how to use the Send to Mail Recipient command. The instructions apply generally to Office 2007 and later versions, but Microsoft® Word 2013 was used for the specific steps and figures.  What is Send to Mail Recipient? Send…
This video teaches the viewer how to align pictures around text while keeping the text properly aligned in the document.
Office 365 is currently available in five editions. Three of them are for business use: Office 365 Business Essentials, Office 365 Business, and Office 365 Business Premium. Two of them are for home/personal use: Office 365 Home and Office 365 Perso…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now