Hello all.
I am starting to get to grips with VB.NET and we are building an
application that autmoates a mail merge. After much trial and error and
wanting to hide in a corner we have the following:
aDoc = wordApp.Documents.Open(fileName, missing, True, missing,
missing, missing, missing, missing, missing, missing, missing,
isVisible)
Debug.WriteLine("opened.....")
aDoc.MailMerge.OpenDataSource( _
Name:=fileSource, _
Connection:=strConn2, _
SQLStatement:=strSQL2)
Debug.WriteLine("open source....")
aDoc.MailMerge.Destination = WdMailMergeDestination.wdSendToPrinter
aDoc.MailMerge.Execute()
Debug.WriteLine("executed....")
aDoc.Close(False)
Debug.WriteLine("Printed")
This works great and is within a larger procedure that writes back to
the database saying that the file has been printed. I am now getting
rather cocky and want to explicitly state which tray the print is
coming out from. I have come across the following:
aDoc.PageSetup.FirstPageTray = WdPaperTray.wdPrinterUpperBin
aDoc.PageSetup.OtherPagesTray = WdPaperTray.wdPrinterLowerBin
but regardless of where I state these it does not make any difference
to the outcome of the print. Can I do this when executing a mailmerge
in the way that I have.
As always, any help would be greatly appreciated.
Martin.