Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Only one instance of Excel?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00943825
Message ID:
00943833
Vues:
17
Hi Peter,
LOCAL loOLE, llCreated
LOCAL ARRAY laErr(1)

* ON ERROR, ::Error(), TRY/CATCH/FINALY
loOLE=GETOBJECT(,"Excel.Application") && Try create object

IF AERROR(laErr)>0
   IF laErr(1,1)=1429 AND "0x800401e3" $ laErr(1,2)
      llCreated=.F. && Nothing Instance
   ELSE
      * Another BUG with OLE
   ENDIF
ELSE
   * Any instance created
   llCreated=.T.
ENDIF

IF !llCreated
   This.ADDPROPERTY('oXL',CREATEOBJECT("Excel.Application"))
ELSE
   This.ADDPROPERTY('oXL',loOLE)
ENDIF
MartinJ

PS: ad RAH, :-D

>A Toolbar with an Excel button:
>
>* Init method
>This.ADDPROPERTY('oXL',CREATEOBJECT("Excel.Application"))
>
>* Click
>
>lcFile = PUTFILE('Save the query as an Excel worksheet','','XL5')
>IF NOT EMPTY(lcFile)
>        SELECT (THIS.ExportFile)
>	EXPORT TO (lcFile) TYPE XL5
>	WITH This
>		.oXL.Workbooks.OPEN((lcFile))
>		IF .oXL.VISIBLE = .F.
>		     .oXL.VISIBLE = .T.
>		ENDIF
>	ENDWITH
>ENDIF
>
>
>This creates a new instance of Excel, where I'd really just want to add
>file2,... aso. to the exisiting instance.
"Navision is evil that needs to be erazed... to the ground"

Jabber: gorila@dione.zcu.cz
Jabber? Jabbim
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform