How to use vb to print a Word Document?

W

WayneM

I am using vb6 to control Word and use the Printout method for the document,
but after this I want to quit Word. The problem is that Word is still
printing when it wants to quit and then there is a Word process stil running.
Any suggestion on how to get around this timing problem?

Thanks in advance

WayneM
 
J

Jonathan West

WayneM said:
I am using vb6 to control Word and use the Printout method for the document,
but after this I want to quit Word. The problem is that Word is still
printing when it wants to quit and then there is a Word process stil running.
Any suggestion on how to get around this timing problem?

Thanks in advance

WayneM

Hi Wayne

Take a look here

How to find out whether Word has finished printing
http://word.mvps.org/FAQs/MacrosVBA/WaitForPrint.htm
 
J

Jay Freedman

Hi Wayne,

Include the optional first parameter of the PrintOut method, and set
it to False:

oDoc.PrintOut (False)
oDoc.Close (0)
oWord.Quit

That parameter (Background) determines whether Word spools to the
printer in the background and immediately executes the rest of the
program, or prints in the foreground and blocks execution until the
printing is complete.
 

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