Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2009-04-01
13
Medium Priority
?
9,561 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
Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

 
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
 
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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Do you ever need to create a 20 page Word document for some testing purpose? Are you tired of copying & pasting old boring "lorem ipsum" text over and over again, increasing font size and line space in order to make the document 20+ pages long? Look…
Microsoft Word is a program we have all encountered at some point, but very few of us have dug deep into its full scope of features, let alone customized it to suit our needs. Luckily making the ribbon (aka toolbar, first introduced in Word 2007) wo…
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

782 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