Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2004

Tip: Looking for answers? Try searching our database.

Switching Between Printers in a Single Macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gilley - 10 Nov 2004 22:53 GMT
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
Gilley - 10 Nov 2004 22:59 GMT
Disregard this message.  See other post.  First post said there was a problem.

http://support.microsoft.com/newsgroups/newsReader.aspx?&lang=en&cr=US&guid=&slo
c=NEWSGROUPLN&dg=microsoft.public.word.vba.general&p=1&tid=b3420459-dc7b-4598-ac
da-96a5d2198568


Regards,

Gilley

Sorry for the trouble.

> Hello,
>
[quoted text clipped - 70 lines]
> Gilley
> aka DilbertIsMyHero
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.