Hi Bob,
You should use createobject & getobject to start with. That way you have a
"pointer" to work with.
(with the proper error checking)
This code example is in your VB6 help file also.
http://msdn.microsoft.com/library/de...getobjectx.asp
The on real "problem" with getobject is it will find any running Excel
session.
The work-around is to specify the full path.
Note this line in the code: "Set MyXL = Getobject("c:\vb4\MYTEST.XLS")
--
John
johnf202 at hotmail dot com
"Robert A. Boudra" wrote in message
...
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