Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open a Word Document from an Access Form

Status
Not open for further replies.

mrchinchin25

IS-IT--Management
Oct 10, 2002
15
GB
Hi,

I'm trying to develop some VB code to open a Word Document from an Access Form. I did a search on EE and found the following code:

Dim doc As Word.Document, wrdApp As Word.Application
On Error Resume Next
Set wrdApp = GetObject(, "word.application")
If Err.Number <> 0 Then
Set wrdApp = CreateObject(&quot;word.application&quot;)
End If
wrdApp.Visible = True
Set doc = wrdApp.Documents.open(&quot;mydoc.doc&quot;)

Where it says &quot;word.application&quot; i've entered the path to my winword.exe file (eg. c:/bla/bla/bla/winword.exe)

Where it says &quot;mydoc.doc&quot; i've put in the path to my file.

The code doesn't do anything, it doesn't open word at all.

Can anyone help?
 
Hi mrchinchin25,

Where it says &quot;Word.Application&quot;, it should say &quot;Word.Application&quot; and not the path you have given it.

Enjoy,
Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top