# Solved: Open word doc with command button in access



## jmk909er (May 20, 2009)

Is there a simple way to open a word doc with a command button in access?


----------



## OBP (Mar 8, 2005)

Yes, do you need to browse to it?


----------



## karlhaywood (Jan 17, 2010)

If your going to open the same word doc everytime you press the button you could try

Dim LWordDoc As String
Dim oApp As Object
'Path to the word document
LWordDoc = "c:\Doc1.doc"
If Dir(LWordDoc) = "" Then
MsgBox "Document not found."
Else
'Create an instance of MS Word
Set oApp = CreateObject(Class:="Word.Application")
oApp.Visible = True
'Open the Document
oApp.Documents.Open filename:=LWordDoc
End If
End Sub

You will need to put in the correct file path of the document you want to open.


----------



## jmk909er (May 20, 2009)

Thanks Guy's I found a solution:

Private Sub Command30_Click()
Application.FollowHyperlink "T:\G4\Maint\Fac Reports\M2R2Weekly Planning Status xcel document\MCRD Projects\MCRD Projects Input Worksheet.doc"
End Sub


----------

