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

Tip: Looking for answers? Try searching our database.

Automatic Printing

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rodger - 30 Jan 2007 01:27 GMT
All,

I have an Access Database that uses the Mail Merge option from Word.  What I
need to know is how do I print my reports from Word Instead of just viewing
them.  If this is the wrong group please let me know the group I should ask.
Here is my code.

Private Sub btnPrint_Click()

Dim ReportPath
Dim oApp As Object, DocName, X

   If IsLoaded("frm_setup") Then
   Else
       DoCmd.OpenForm "frm_setup", acNormal, , , , acHidden
   End If

   ReportPath = Forms![frm_Setup]![SET_CURRENT_DATABASE]

   Set oApp = CreateObject("Word.Application")

   'Environmental
       If Me.ckbEnvironmental = -1 Then
           oApp.Documents.Open FileName:="" & Chr(34) & ReportPath & "\504
CDC Checklist for Submitting Environmental Investigation.doc" & Chr(34)
           oApp.Visible = True
       End If
End Sub

TIA,
Rodger
Jezebel - 30 Jan 2007 04:27 GMT
1. When you create the document, get a reference to it:

Dim oDoc as object

Set oDoc =  oApp.Documents.Open (FileName:=ReportPath & ...)

2. Use the document's print method

oDoc.PrintOut ...

> All,
>
[quoted text clipped - 27 lines]
> TIA,
> Rodger
Doug Robbins - Word MVP - 30 Jan 2007 04:41 GMT
Jezebel's answer may be all that you need, but just in case, see the article
"How to do a mail merge to the printer using VBA, without displaying the
Print dialog" at:

http://www.word.mvps.org/FAQs/MailMerge/MergeStraightToPrintrWVBA.htm

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> All,
>
[quoted text clipped - 27 lines]
> TIA,
> Rodger
Rodger - 31 Jan 2007 13:06 GMT
Great thank you both I will try that out and let you know!!!!!

> All,
>
[quoted text clipped - 27 lines]
> TIA,
> Rodger
 
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.