To open a specific Word document from Excel (Office 2003), I have the following (obviously on a button):
When CreateObject is used, the Word document is the active application...when GetObject is used, I cannot figure out a way to make it the active application. I have tried various iterations of visible and activate...any suggestions?
BTW, the reason I am using a button is a hyperlink to a network document does not work in a protected worksheet...strange hunh!!
Code:
Private Sub CommandButton1_Click()
On Error Resume Next
Err.Clear
Set wrd = GetObject(, "Word.Application")
If Err.Number = 429 Then
Err.Clear
Set wrd = CreateObject("Word.Application")
If Err.Number = 429 Then
MsgBox "MS Word is not installed on the computer."
End If
End If
wrd.Documents.Open "March05.doc"
wrd.Documents("March05.doc").Activate
wrd.Visible = True
Set wrd = Nothing
End Sub
BTW, the reason I am using a button is a hyperlink to a network document does not work in a protected worksheet...strange hunh!!