Change Printer

S

Steven Taylor

I am running code from within Access to print a mail merge
document:

Function OpenContract(ContracType as Integer)

Dim ContFile As String
Dim WrdApp As New Word.Application

ContFile = ContractDocumentName(ContractType) 'Produces
the path and name of the mail merge document

WrdApp.Documents.Open ContFile

With WrdApp.ActiveDocument.MailMerge
..Destination = wdSendToPrinter
..Execute

End With
WrdApp.ActiveDocument.Close savechanges:=False
WrdApp.Quit
End Function


This works fine but after the .Execute command a print box
appears for the user to select the printer to print on etc.
What code do I use to automatically select the printer and
print 2 copies?

TIA
S Taylor
 
D

Doug Robbins - Word MVP

Hi Steven,

See the article "Changing the selected (current) printer in Word without
changing the system default printer" at:

http://www.mvps.org/word/FAQs/MacrosVBA/ChangeCurPrinter.htm

and probably also "How to do a mail merge to the printer using VBA, without
displaying the Print dialog

Or in the case of Word 2002, how to do the opposite!" at:

http://www.mvps.org/word/FAQs/MailMerge/MergeStraightToPrintrWVBA.htm

Please respond to the newsgroups for the benefit of others who may be
interested.

Hope this helps
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