Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Test to see if excel is present
Message
De
31/03/2003 10:55:53
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00771427
Message ID:
00772030
Vues:
8
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform