I have the following code at the beginning of my program. I need to know if there is a running instance of Word running before I create one. I have seen in many examples the use of "GetObject" to figure out if there is an instant running. But it is not working for me. What am I doing wrong?. Always I get the error number "429" even having several instances of Word openned. Thanks for your help.
'
On Error Resume Next
' Check if there is a Word Application open.
Set WordApp = GetObject("", "Word.Aplplication")
theerror = Err.Number
If Err.Number <> 0 Then
' Creating a MS Word application object.
GoSub P050_Set_Word
Else
AnswerSel = MsgBox("There is a Word Application openned." & Chr(10) & "Please proceed to close it before starting the program.", vbOKOnly, "Word Document Opened")
End If
'
On Error Resume Next
' Check if there is a Word Application open.
Set WordApp = GetObject("", "Word.Aplplication")
theerror = Err.Number
If Err.Number <> 0 Then
' Creating a MS Word application object.
GoSub P050_Set_Word
Else
AnswerSel = MsgBox("There is a Word Application openned." & Chr(10) & "Please proceed to close it before starting the program.", vbOKOnly, "Word Document Opened")
End If