Here is the instruction I have for the one button on the document. This
button will open a Form and then take you to a module to gather data and
place it in the named bookmarks in Word.

Private Sub CommandButton1_Click()

DemogInfoForm_Initialize

End Sub

Anyway,

The problem I'm having is how (or where should I place the code) to hide the
button when it is printed? I have the code instructions below taken from
your previous questions.....

With ActiveDocument

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

End With

Thank you for your help!

Tom

Re: Hiding the Print Button While Printing Again Please... by Jonathan

Jonathan
Fri Apr 11 10:39:46 PDT 2008

Hi Tom

Changing this

.PrintOut Background:=False

to this

.PrintOut Background:=True

will prevent the button from showing, but this has certain disadvantages if
you want the macro to continue doing something else after printing or you
want to print several documents in sequence.

If you don't want to print in the background, then there is nothing in the
Word VBA object model to allow you to suppress the printing progress dialog.
It may be possible by means of clever manipulation of the Windows API, but I
really wouldn't recommend going that route. If I recall from experimenting
with that, you end up needing to use timer objects, and start off some code
before you start printing that regularly checks all the windows, and hides
or minimizes the print window if found. Its a fairly substantial piece of
code to get it all working. I can't recall if I ever did get it working to
my satisfaction.

--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup




"TomP" <TomP@discussions.microsoft.com> wrote in message
news:3F930D98-A4B0-4747-AC70-45935A3FC8C5@microsoft.com...
> Here is the instruction I have for the one button on the document. This
> button will open a Form and then take you to a module to gather data and
> place it in the named bookmarks in Word.
>
> Private Sub CommandButton1_Click()
>
> DemogInfoForm_Initialize
>
> End Sub
>
> Anyway,
>
> The problem I'm having is how (or where should I place the code) to hide
> the
> button when it is printed? I have the code instructions below taken from
> your previous questions.....
>
> With ActiveDocument
>
> .Shapes(1).Visible = msoFalse
> .PrintOut Background:=False
> .Shapes(1).Visible = msoTrue
>
> End With
>
> Thank you for your help!
>
> Tom