TechWhirl (TECHWR-L) is a resource for technical writing and technical communications professionals of all experience levels and in all industries to share their experiences and acquire information.
For two decades, technical communicators have turned to TechWhirl to ask and answer questions about the always-changing world of technical communications, such as tools, skills, career paths, methodologies, and emerging industries. The TechWhirl Archives and magazine, created for, by and about technical writers, offer a wealth of knowledge to everyone with an interest in any aspect of technical communications.
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