Using the PrintOut Method via VBA in Microsoft Word.

K

Kevin E.

I have a Word Document setup with a bunch of Label Controls placed in the
Body of the Document. I have a macro setup that takes information from an
excel spreadsheet and fills the labels with text...and then prints the
document...everything worked fine when I first created the document and
program but now the print method is broken. When i start the macro, i open
the printer properties window and see that the documents are being
spooled...and when the macro finishes the printer deletes the documents from
the printer que...does anybody know why this is happening. At the begining
of my project i started printing about ten documents...now i am only trying
to print two documents...After the macro ends the document closes...am i
quitting the program too soon so that all the printing information being sent
to the printer doesnt quite get there in all of its entirety with only two
documents being printed as opposed to ten.


here is the printer code that i am using, i inserted a pause for the
document to spool and print before going to the next document to print but it
didnt work the way i thought it would because watching the printer properties
window i see all documents spool until the macro finishes and then they all
begin to print (when everything was working properly):

wrdDocument.PrintOut
PauseTime = 20
Start = Timer
Do While Timer < Start + PauseTime
DoEvents
Loop
 
D

Doug Robbins - Word MVP

Try setting the Background attribute of the PrintOut command to False so
that execution of the balance of the macro commands is delayed until the
printing (at least spooling) has been completed.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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