Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating Word Document

Status
Not open for further replies.

vr

Programmer
Oct 14, 1999
54
0
0
US
I am creating a letter in Word 2000 via Access VBA. It all works fine, except, I need to set the paper source to manual feed for printing. Can anyone help? This is a new word object, not a Word Merge.

Here is a sample of the code:

Set oApp = New Word.Application
Set wDoc = oApp.Documents.Add
oApp.Visible = True

With wDoc
.PageSetup.LeftMargin = 90
.PageSetup.RightMargin = 90
.PageSetup.TopMargin = 100
.Range.Font.Name = "Arial"
.Range.Font.Size = 11
End With

With oApp
.Selection.TypeText Format(Now(), "mmmm d, yyyy")
.Selection.TypeParagraph
.Selection.TypeParagraph
.Selection.TypeParagraph
.Selection.TypeParagraph
.Selection.TypeText "blah blah blah"
End With



Thanks!
 
My firm is still using Word 97 but the following probably still applies:

To set the document to a manual feed (this setting is saved with the document)
With wDoc
.PageSetup.OtherPagesTray = 4 'wdPrinterManualFeed
.PageSetup.FirstPageTray = 4 'wdPrinterManualFeed
end with

To change the Word default print tray to manual feed:
Options.DefaultTrayID = 4 'wdPrinterManualFeed

If you use this I recommend that you save the DefaultTrayID setting before changing it, then change it back after you print or everything the user prints will expect a manual feed.

Limitations: The manual feed tray number seems dependent on the print driver. The number 4 will probably work for most printers but if I run this code using a postscript print driver for the same printer it does not work because it expects 257 to be the manual feed setting.
 
Try This:

Code:
With wDoc
    .PageSetup.LeftMargin = 90
    .PageSetup.RightMargin = 90
    .PageSetup.TopMargin = 100
    .PageSetup.FirstPageTray = wdPrinterManualFeed   ' <<<---
    .Range.Font.Name = &quot;Arial&quot;
    .Range.Font.Size = 11
End With
VBSlammer
redinvader3walking.gif

Unemployed in Houston, Texas
 
Thank you both!

Works great!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top