Information générale
Catégorie:
Codage, syntaxe et commandes
>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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement