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

Subject: Re: Word 2010 - VB CommandButton - Printing, but don't want to print button
From: Tony Chung <tonyc -at- tonychung -dot- ca>
To: Emoto <emoto1 -at- gmail -dot- com>, TECHWR-L <techwr-l -at- lists -dot- techwr-l -dot- com>
Date: Tue, 21 Apr 2015 09:50:50 -0700

Why are you creating the buttons in the document? Why don't you just add a
button to the ribbon? The document can display the button when the document
opens, then remove the button when the document closes.

That's the proper design pattern.

-Tony

On Tue, Apr 21, 2015 at 6:39 AM, Emoto <emoto1 -at- gmail -dot- com> wrote:

> 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 tonyc -at- tonychung -dot- ca -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
>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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:

References:
Word 2010 - VB CommandButton - Printing, but don't want to print button: From: Emoto

Previous by Author: Re: If you wanted to get one technical communication book, what would it be?
Next by Author: Re: Word 2010 - VB CommandButton - Printing, but don't want to print button
Previous by Thread: Word 2010 - VB CommandButton - Printing, but don't want to print button
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


Sponsored Ads