Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Test to see if excel is present
Message
From
31/03/2003 10:55:53
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00771427
Message ID:
00772030
Views:
7
>If type("ObjExcel")="O" and not isnull(ObjExcel)
>*already up
>endif
>

Actually, for Excel, that may not work correctly. Excel can stay in memory even after you shut it down. If you grab that instance again, it's only partially functional.

The only way I've found to reliably track whether an instance of Excel that I created via Automation is still available is to use an extra variable to keep track of Excel's expected visibility. If my variable and Excel's Visible property match, life is good.

Here's some code from the Automation book:

IF IsNull(This.oServer)

* No instantiated server

lReturn = .F.

ELSE

* Compare actual Visible value to tracked visibility

IF This.oServer.Visible = This.lShouldBeVisible

* They match, so the server is open and good

lReturn = .T.

ELSE

* Visibility doesn't match. User must have shut server down

lReturn = .F.

ENDIF

ENDIF

RETURN lReturn


Tamar
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform