open word doc

S

swain.s

is it possible to open a word doc using a button that i have put onto a
excel worksheet
 
S

Sheeloo

Attach this macro to the button
Sub test()
Set wrdApp = CreateObject("Word.Application")
'Uncomment the next line to open a specific document and change the path and
name
'Set wrdDoc = wrdApp.Documents.Open("C:\Doc1.doc")
wrdApp.Visible = True
End Sub
 
S

swain.s

hello i have tried the macro but i keep getting erreor on the set wdrApp
second line
 
S

Sheeloo

Sorry I forgot to add that you must pick Microsoft Word 11.0 from
Tools>References in the VB editor to execute Word commands.

See VB Help topic "Controlling One Microsoft Office Application from Another"
for more information.

Also if you have set Option Explicit then declare
Dim wrdApp As Word.Application
 
S

swain.s

hello Sheelo

ican now open a word doc but the page is empty the doc that i am trying to
open is not opening
 
S

Sheeloo

Did you remove the comment indicator (') from the following line
'Set wrdDoc = wrdApp.Documents.Open("C:\down.doc")

You also need to change the path and name to your document
 
Top