call Word document

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is is possible to call and print a Word document (template) from Access using
vba?
Thanks
 
To open a word document, create reference to Microsoft Word and then

Function Open_WordDoc()

Dim objWord As Word.Application
Dim objDoc As Word.Document
Dim DocPath As String

DocPath = "Path and name of the document"

Set objWord = New Word.Application
Set objDoc = objWord.Documents.Open(DocPath)

objDoc.Activate
objDoc.PrintOut ' To print out
objWord.Visible = True ' To display

End Function
 
How can I make this work in access 2007? The object Word.application doesn't
work anymore, does it?
 
From the VBA code window in Access you have to go to "Tools / References..."
and add the reference to the "Microsoft Word x.0 Object Library" before you
can declare the Word.Application object.

I'm using Office XP so my reference to the 10.0 Object Library, so I assume
Office 2003 is 11.0 and Office 2007 is 12.0
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top