print from Word

  • Thread starter Thread starter Joanne
  • Start date Start date
J

Joanne

Hello helpers (God bless you every one)
I need to print several reports from my access database (using access
2000) as part of a 'package' to be sent out and baout.
I would like to print a couple of docs from msword to be a part of
this 'package'
Is this possible to call these word .docs from access and have them be
a part of my access printout?
I think it is from some of the stuff I've been reading hanging around
the newsgroups, but I really am not sure, and also haven't got the
knowledge to make it happen.
Your time and expertise is always muchly appreciated
Joanne
 
Joanne:

Yes, you can use what is called Automation to launch MS Word, from within
Access (using Visual Basic code) and output target Word docs to a printer.
Obviously these wouldn't truely be part of an Access report perse, but you
could create a routine whereby report 1 is printed, then a Word doc, report
2, etc. The code to output a Word document from within Access is fairly
simple with an example below.

Another option is to create a singlePDF file from your multiple Access and
Word documents and merge the various components into on file for e-mailing,
or storage and retrieval. If this is of interest, you might take a look at
our PDF and Mail Library for Access, PDF Pro Plus edition that can help you
do that with very modest code.

Hope this helps
--
Steve Arbaugh
ACG Soft
http://ourworld.compuserve.com/homepages/attac-cg

-------------begin Word Automation Code------------
Function PrintWordDoc(strDocPathAndFileName as String) as Boolean
On Error goto ErrHandler
Dim objWord as Object, objDoc as Object
Const wdPrintAllDocument = 0

Set objWord = CreateObject ("Word.Application")
objWord.Visible = True '(False if you don't want to see all the action)
Set objDoc = objWord.Documents.Open (strDocPathAndFileName)
DoEvents
objWord.ActiveDocument.PrintOut , _
Background:=False, _
Range:=wdPrintAllDocument
DoEvents
objDoc.Close False
objWord.Quit

PrintWordDoc = True
ExitProc:
Exit Function
ErrHandler:
PrintWordDoc = False
MsgBox "Error: " & Err.Number & " " & Err.Description
Resume ExitProc
End Function
 
Back
Top