View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
James[_33_] James[_33_] is offline
external usenet poster
 
Posts: 1
Default Check to see if Excel has closed

Don't know if this is any help, but try to look on help in excel or vb6.0 on
"GetObject".

Grtz,
James

"Robert A. Boudra" schreef in bericht
...
Jim:

When I try that, it doesn't seem to work. The "TypeName" function still
returns the object type of "Application", even if the user has closed the
Excel Session.

Bob

"Jim Cone" wrote in message
...
Bob,
Something similar to the following (used to check for Word"),
should work for you...
'------------------------
Public appWord As Word.Application

Sub CreateWord()
Set appWord = New Word.Application
appWord.Visible = True
End Sub

'User could close application here

Sub CheckForWord()
If TypeName(appWord) = "Application" Then
appWord.Quit
Set appWord = Nothing
Else
'do something else
End If
End Sub
'------------------------
Regards,
Jim Cone
San Francisco, CA

"Robert A. Boudra" wrote in message

...
I am building a VB6 application that uses Automation to populate an

Excel
worksheet with data from a database table. When cleaning up as the
application closes, is there any way to check to see if the user has
manually closed the Automation server (Excel session) before I attempt

to
close it in code?
Bob