View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
R-N R-N is offline
external usenet poster
 
Posts: 4
Default opening a word document from excel

Chri

This works in Excel 2002: I added a reference to Microsoft Word 10.0 Object Library so I could be more specific in my Dim statement, but it may be possible to do it without that. I think the secret is to open Word first and then load he doc

Sub testOpenWord(
Dim wrd As Word.Applicatio
Const cWrdDoc = "E:\Master Code\Code for XXX 040112.doc" 'YOUR FILE PATH HER

Set wrd = GetObject(, "Word.Application"
'Set wrd = GetObject(cWrdDoc, "Word.Application"
If Err.Number = 429 The
Set wrd = CreateObject("Word.Application"
Err.Number =
End I
wrd.Visible = Tru
wrd.Documents.Open Filename:=cWrdDo
'et
'et
End Su