Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Test for Excel instance?
Message
From
21/02/2002 12:33:13
 
 
To
21/02/2002 06:09:41
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00621712
Message ID:
00623251
Views:
21
Cetin:

>Use createobject instead. To use the same instance use workbooks collection (add, open).

Ok. Back to the original question. If a separate Fox.exe needs Excel how does it know that Excel has already been instantiated by another application in order to use the existing instance?

As I said, getobject() will create an instance if one doesn't exist. Createobject will create an instance irrespective.

If I am mid-program and I want to ask the following question ...

"Is there an instance of Excel already instantiated on this workstation" - how can I get an answer?

If I am asking the same question of Word 2000, I use getobject('word.application'). If there is an instance already, I get a reference to it. If there isn't, I get an OLE error that I can test for that answers the question, "No there isnt an instance of Word instantiated at the moment". So, I can get a Yes/No result with changing anything (ie., it wont create an instance of Word if there isnt one, it will return a reference to the Word if there is one).

If I do this with Excel 2000, the getobject behaviour will instantiate Excel when it isnt already instantiated. Therefore, it doesn't answer the question, if just performs an action that I dont want it to <s>.

-=Gary
-=Gary
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform