call Word document

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
Back
Top