Opening a Word file from Access

A

anns

How do I go about opening a specific Word file from Access? I can get the
application to open using the RunApp command and pointing it to WINWORD on
the C: drive but how do I get it to a distinct file which would probably be
on a shared drive?

Thanks.
 
P

pietlinden

How do I go about opening a specific Word file from Access?  I can get the
application to open using the RunApp command and pointing it to WINWORD on
the C: drive but how do I get it to a distinct file which would probably be
on a shared drive?

Thanks.

tweak the VBA...
Private Sub cmdRunWord_Click()
On Error GoTo Err_cmdRunWord_Click

Dim oApp As Object

Set oApp = CreateObject("Word.Application")
oApp.Visible = True
'===NEW LINE====

oApp.Documents.Add "R:\PathOnNetworkDrive\myfile.doc" '---Or \
\ServerName\Directory\FileName.doc
' if the file is in a control on your form, just use
' oApp.Documents.Add Me.Controls("txtFileToOpen")

Exit_cmdRunWord_Click:
Exit Sub

Err_cmdRunWord_Click:
MsgBox Err.Description
Resume Exit_cmdRunWord_Click

End Sub

or use a hyperlink instead...
 

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

Top