Open Word document


Posted by lucky on January 02, 2002 8:50 AM

Is it possible to use a command button in excel to open the Microsoft Word application and specific document?
For an Excel worksheet I have been using this:
Workbooks.Open ("c:\xx\xxxx")

Is there an equivalent for word.
Cheers!

I am using Excel and Word 97

Posted by Dank on January 02, 2002 9:21 AM


You need to use something called automation. Something like this:-

Sub OpenAWordDoc()
Dim WdApp As Object, WdDoc As Object

Set WdApp = CreateObject("Word.Application")
WdApp.documents.Open "C:\test.doc"
WdApp.Visible = True

End Sub

HTH,
Daniel.



Posted by lenze on January 02, 2002 10:19 AM

Another way without using code would be to attach a hyperlink to the command button that points to the Word document. This will automatically start Word and open the target file.