Hiding the Print Button While Printing Again Please...

T

TomP

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
 
J

Jonathan West

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top