Word 2010 - VB CommandButton - Printing, but don't want to print button

Subject: Word 2010 - VB CommandButton - Printing, but don't want to print button
From: Emoto <emoto1 -at- gmail -dot- com>
To: techwr-l -at- lists -dot- techwr-l -dot- com
Date: Tue, 21 Apr 2015 09:39:18 -0400

Greetings fellow tech writers!

I am not a VB guy, but at a client's request and with great fear &
loathing, have set up a Word 2010 doc (.docm) so that it will have buttons
in it that print designated pages when clicked. I have that part working ok.

What I am struggling with is how to incorporate the code to print the
pages, but not show the button on the printed pages.

My code looks like this:

Private Sub CommandButton1_Click()
ActiveDocument.PrintOut Range:=wdPrintRangeOfPages, Pages:="6"
End Sub
_____________________________________________________________________

Private Sub CommandButton2_Click()

End Sub
_____________________________________________________________________

Private Sub CommandButton11_Click()
ActiveDocument.PrintOut Range:=wdPrintRangeOfPages, Pages:="4-5"
End Sub
_____________________________________________________________________

Private Sub CommandButton21_Click()
ActiveDocument.PrintOut Range:=wdPrintRangeOfPages, Pages:="2-3"
End Sub

The code I find that seems to be what I want is:

Private Sub CommandButton1_Click()

With ActiveDocument
.Shapes(1).Visible = msoFalse
.PrintOut Background:=False
.Shapes(1).Visible = msoTrue
End With

End Sub


I haven't been able to figure out how/where to incorporate any of this
without getting errors, or I get no error, but the button remains visible.

Can anyone please show me what to put where, so that I will still print my
pages, but the button won't show? I try to avoid VB....

Thanks!

Bob
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Adobe TCS 5: Get the Best of both worlds: modern publishing and best in class XML \ DITA authoring | http://adobe.ly/scpwfT

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

You are currently subscribed to TECHWR-L as archive -at- web -dot- techwr-l -dot- com -dot-

To unsubscribe send a blank email to
techwr-l-leave -at- lists -dot- techwr-l -dot- com


Send administrative questions to admin -at- techwr-l -dot- com -dot- Visit
http://www.techwhirl.com/email-discussion-groups/ for more resources and info.

Looking for articles on Technical Communications? Head over to our online magazine at http://techwhirl.com

Looking for the archived Techwr-l email discussions? Search our public email archives @ http://techwr-l.com/archives


Follow-Ups:

Previous by Author: Re: New writer looking for advice
Next by Author: Re: Word 2010 - VB CommandButton - Printing, but don't want to print button
Previous by Thread: Re: Guidelines for using notes
Next by Thread: Re: Word 2010 - VB CommandButton - Printing, but don't want to print button


What this post helpful? Share it with friends and colleagues:


Sponsored Ads