Open Word Document

  • Thread starter Thread starter Guest
  • Start date Start date
FGM said:
How do I open a word document from Access with VBA coding???

Thanks

The below worked for me.

First set a reference in Access to word. Do that by opening up the Visual
Basic Editor and choosing Tools / References from the menu path. Then ensure
that Microsoft Word 9.0 object library is checked (or whatever version of
word is on your machine).

Then insert a module and put the following code in.

Sub Word()
Dim appWD As New Word.Application
appWD.Documents.Open "full filepath and filename"
appWD.Visible = True
End Sub

There may be other variations but this works too.

Regards,
Bill Horton
 
Thank you...
I did that however I would like that window to become the active window. It
opens the file but then I have to go click on the icon as the active window
is still the Access form. I tried
myWDApp.Application.Activate
and then it comes and tells me it is in use do I want a copy then if I say
yes it becomes the active window with a copy..
Do you know how to make it the active window?

Thanks... again again...
 
Hi,
I tried a different file. I closed down my computer and restarted and the
previous file came up in word as a recovery so there must have been something
wrong with that one file...
Thanks for the help..
 
Back
Top