Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Launching Excel from within FoxPro
Message
 
À
26/07/1998 12:08:48
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00120781
Message ID:
00121497
Vues:
20
Hi François,

There is a workaround to that error you had mentioned.

oExcel = GETOBJECT(,"Excel.application")

would result in an error if an excel session is not running. You need to pass an empty string as the first parameter. This way if an excel session is running you get an object reference to it otherwise a new session is created and an object reference is returned.

oExcel = GETOBJECT("","Excel.application")
oExcel.Visible = .T.



> LOCAL oExcel
> oExcel = GETOBJECT(,"Excel.application")
>
>because this code will obviously trigger an error when no excel session is running, insert specific code in the form ERROR management loop such as
>
>DO CASE
>** no Excel instance running ... run one a session (or inform user)
>CASE method="checkexcel"
>
> MESSAGEBOX("please run an Excel session")
> RETURN
>
>OTHERWISE
>...
>ENDCASE
>
>Regards from Paris
>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform