Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Test for Excel instance?
Message
 
To
26/02/2002 13:03:44
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00621712
Message ID:
00625309
Views:
18
>>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,
>I'm sorry I don't know the answer.

Cetin,

I'm not sure if this answers Gary's question (I'm cc-ing him), but for myself, I don't bother with GETOBJECT for Office 2000 because opening a file simply spawns another instance of Excel or Word.
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform