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 / June 2007

Tip: Looking for answers? Try searching our database.

Why doesnt my macro record paper tray change in printer options?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mr t - 13 Jun 2007 16:34 GMT
I have recorded a macro to print one copy of a letter on letterhead, one copy
on plain paper, and then print the envelope.

The macro will not switch from plain paper to letterhead when running (or
from whatever the last setting was)

Thanks

Sub PrntLtrEnv()
'
' PrntLtrEnv Macro
' Macro recorded 6/13/2007 by
'
   Selection.MoveDown Unit:=wdLine, Count:=2
   Selection.MoveDown Unit:=wdLine, Count:=5, Extend:=wdExtend
   ActiveDocument.Envelope.PrintOut ExtractAddress:=False,
OmitReturnAddress _
       :=False, PrintBarCode:=False, PrintFIMA:=False,
Height:=InchesToPoints( _
       4.13), Width:=InchesToPoints(9.5), Address:="Anna Smith", AutoText:= _
       "ToolsCreateLabels1", ReturnAddress:="", ReturnAutoText:= _
       "ToolsCreateLabels2", AddressFromLeft:=wdAutoPosition,
AddressFromTop:= _
       wdAutoPosition, ReturnAddressFromLeft:=wdAutoPosition, _
       ReturnAddressFromTop:=wdAutoPosition,
DefaultOrientation:=wdLeftLandscape _
       , DefaultFaceUp:=True, PrintEPostage:=False
   Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
       wdPrintDocumentContent, Copies:=1, Pages:="",
PageType:=wdPrintAllPages, _
       ManualDuplexPrint:=False, Collate:=True, Background:=True,
PrintToFile:= _
       False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
       PrintZoomPaperHeight:=0
   Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
       wdPrintDocumentContent, Copies:=1, Pages:="",
PageType:=wdPrintAllPages, _
       ManualDuplexPrint:=False, Collate:=True, Background:=True,
PrintToFile:= _
       False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
       PrintZoomPaperHeight:=0
End Sub
Graham Mayor - 14 Jun 2007 09:39 GMT
Your macro doesn't change the trays. Assuming that you have already added
the envelope to the document then you need something like

Sub PrintLetterandEnv()
Dim sTray As String
sTray = Options.DefaultTray
Options.DefaultTray = "Envelope Feeder"
Application.PrintOut FileName:="", Range:=wdPrintRangeOfPages, Item:= _
       wdPrintDocumentContent, Copies:=1, Pages:="0",
PageType:=wdPrintAllPages
Options.DefaultTray = "Tray 1"
Application.PrintOut FileName:="", Range:=wdPrintRangeOfPages, Item:= _
       wdPrintDocumentContent, Copies:=1, Pages:="s2-s99", PageType:= _
       wdPrintAllPages
Options.DefaultTray = "Tray 2"
Application.PrintOut FileName:="", Range:=wdPrintRangeOfPages, Item:= _
       wdPrintDocumentContent, Copies:=1, Pages:="s2-s99", PageType:= _
       wdPrintAllPages
Options.DefaultTray = sTray
End Sub

This will print the envelope to the Envelope Feeder tray and a copy of the
letter to each of trays 1 and 2.
The tray designations may not match your printer. See
http://www.gmayor.com/fax_from_word.htm for background.

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> I have recorded a macro to print one copy of a letter on letterhead,
> one copy on plain paper, and then print the envelope.
[quoted text clipped - 39 lines]
>        PrintZoomPaperWidth:=0, _ PrintZoomPaperHeight:=0
> End Sub
 
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.