Switching Between Printers in a Single Macro

G

Gilley

Hello,

I am in a fix. I have a macro that basically needs to perform the following
tasks:

Save a mail merge document to an RTF with a specific name. (So far so good
on this one!)
Print the RTF to a PDF file.
Print the RTF to the printer on LPT1.
Delete the RTF.
Close any remaining open windows.

Most of the macro is working fine. My trouble is switching between the two
printers. No matter what I do, the default printer is being changed to Adobe
PDF. I either need to know how to prevent this or how to switch it back to
the printer on LPT1.

The template, which incorporates this macro, is being distributed to several
different people each with different printers and printer names.

Is there a way to accomplish what I need????

Here is my macro so far ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sub OSDFileSaveAsRTF()
'
' OSDFileSaveAsRTF Macro
' Save merged file as an RTF file
'

With ActiveDocument.Bookmarks
strFileName = .Item("OSDNumber").Range.Text
strFileName = strFileName & .Item("BasicForm").Range.Text
End With

ActiveDocument.SaveAs FileName:="c:\osd\" & strFileName & ".rtf", _
fileformat:=wdFormatRTF

'Print saved RTF File to PDF File
With Dialogs(wdDialogFilePrintSetup)
.Printer = "Adobe PDF"
.DoNotSetAsSysDefault = True
.Execute
End With

'ActivePrinter = "Adobe PDF"
Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
wdPrintDocumentContent, Copies:=1, Pages:="",
PageType:=wdPrintAllPages, _
Collate:=True, Background:=True, PrintToFile:=False,
PrintZoomColumn:=0, _
PrintZoomRow:=0, PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0


'Set active printer back to printer on LPT1
'ActivePrinter = " on LPT1:"

'Delete RTF File
'ActiveDocument.Close
'Kill "c:\osd\" & strFileName & ".rtf"

'Close remaining active documents
'ActiveDocument.Close savechanges:=wdDoNotSaveChanges

End Sub
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Any help would be greatly appreciated.

Thanks in advance for your assistance.

Regards,

Gilley
aka DilbertIsMyHero
 

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