Printing With Code

  • Thread starter Thread starter Joel
  • Start date Start date
J

Joel

Hello,

Here is some code I use to print a Word template. But how can I make it
print from a certain printer and print a certain # of copies?

Sub CommandButtonPilkRelease_Click()
Dim objDoc
Set objDoc =
GetWordDocPilkRelease("\\tgps8\drawing$\Jobs\Task_Templates\ReleaseGlass.dot
")
Call FillFieldsPilkRelease(objDoc)
objDoc.Application.Options.PrintBackground = True
objDoc.PrintOut
objDoc.Close wdDoNotSaveChanges
Call RestoreWordPilkRelease
Set objDoc = Nothing
End Sub
 
When in doubt, check the object browser: Press ALt+F11 to open the VBA
environment in Outlook, then press F2. If you don't already have a reference
to Word in the VBA project, add it with Tools | References. Switch from <All
Libraries> to Word to browse all Word objects and their properties, methods,
and events. Select any object or member, then press F1 to see its Help
topic.

You should find Application.ActivePrinter and Document.PrintOut useful to
your project.
 
Thank you Sue. Good advice.

Sue Mosher said:
When in doubt, check the object browser: Press ALt+F11 to open the VBA
environment in Outlook, then press F2. If you don't already have a reference
to Word in the VBA project, add it with Tools | References. Switch from <All
Libraries> to Word to browse all Word objects and their properties, methods,
and events. Select any object or member, then press F1 to see its Help
topic.

You should find Application.ActivePrinter and Document.PrintOut useful to
your project.


--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Back
Top