Jay
Thu Aug 10 23:04:40 CDT 2006
One further bit: To avoid the error message about "Word is still
printing", use the optional Background parameter in the .PrintOut
command:
doc.PrintOut Background:=False
That tells VBA that it has to wait until printing is complete before
it can go on to execute the next line of the macro. If you omit the
Background parameter, VBA assumes that it has its default value, which
is True. That allows the rest of the macro to continue to execute
while printing goes on "in the background", and since the next
instruction is to close the document, that's when the error message
appears.
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ:
http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
On Fri, 11 Aug 2006 10:47:16 +1000, "Jezebel"
<warcrimes@whitehouse.gov> wrote:
>Sounds like your macros were created using the macro recorder rather than by
>reading the documentation.
>
>1. To print the document to the active printer, use: doc.Printout
>
>2. To use Word dialogs without being prompted for information, use the
>methods of the Dialogs collection.
>
>3. To close a document without being prompted to save, use doc.Close
>SaveChanges:=False
>
>All of these things are explained, simply, in the help files for the
>respective keywords. To complain that you 'know extremely little about
>programming', in this context, is like complaining that you know very little
>about driving but your car keeps running into trees; can someone help with
>the trees?
>
>
>
>
>
>
>"timc" <timc@discussions.microsoft.com> wrote in message
>news:1CC9C2B0-F14D-4F05-A0B1-AFB4D791F0C9@microsoft.com...
>> first let me say i know extremely little about programming. i have made a
>> macro in access that launches a mail merge document in word. after running
>> the macro, the output is printed and then word is to close the file and
>> exit
>> back to access. here are my problems.
>>
>> 1. when i run the macro in word (run to printer) the printer dialogue box
>> shows up so i have to pick the printer to print to.
>> 2. if i run the word macro to a new document and print, i get the dialogue
>> box that wants to know if i want to save the new file.
>> 3. i then get an error message telling me that word is still printing and
>> cannot exit (the printing has already ended when i get this message.)
>>
>> needless to say that having to deal with these issues makes automating my
>> process very difficult. if anyone out there know how do deal with these
>> please advise. much apprecaited.
>