-
Pro's Only - Enter Here
How do i check if word is already open and if its open get a automation handle that works the same as
set wrd = getobject("word.application") Etc
And if my program crashes hwo can i get word shold close if i opened it with getobject.
Really app any help
-
Code:
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub Command1_Click()
Dim rc As Long, objWord As Object
rc = FindWindow("OpusApp", vbNullString)
If rc Then MsgBox "The window handle is " & rc: Exit Sub
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
End Sub
***Just realized, you wanted the automation handle.