Selecting Printer Tray for Mail Merge

C

cyb3rwolf

Hello everyone,

I wrote the below function for automatically sending a Mail Merge document
to the printer through access. Depending on which document it is, i want to
send it to a different printer tray. Here is my coding so far. This would
obvioulsy be for the case of send to printer...

Public Function ExMailMerge(Dest As String, DBPath As String, DocPath As
String, strSQL As String, Optional MailSubject As String, Optional EmailField
As String)

Dim objWord As Word.Document
Set objWord = GetObject(DocPath, "Word.Document")

objWord.MailMerge.OpenDataSource Name:=DBPath, LinkToSource:=True,
AddToRecentFiles:=False, _
SQLStatement:=strSQL



Select Case Dest
Case "Letter"
objWord.MailMerge.Destination = wdSendToNewDocument
Case "email"
objWord.MailMerge.MailSubject = MailSubject
objWord.MailMerge.MailAddressFieldName = EmailField
objWord.MailMerge.Destination = wdSendToEmail
Case "Print"

objWord.MailMerge.Destination = wdSendToPrinter
End Select

objWord.MailMerge.Execute
objWord.Close wdDoNotSaveChanges




Set objWord = Nothing

End Function
 

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