Opening a Word file from Access

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