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