PDA

Click to See Complete Forum and Search --> : Pro's Only - Enter Here


shragel
May 18th, 2001, 02:50 PM
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

Lethal
May 18th, 2001, 05:50 PM
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.