Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Excel automation and procedures
Message
De
20/03/2018 11:41:20
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01658838
Message ID:
01658859
Vues:
50
>>>Hi: I am doing excel automation but am finding some discrepancies, I think, so wanted to check out some things.
>>>
>>>1. I usually begin by making the variable that I will be using for excel, by making it public:
>>>
>>>PUBLIC oExcel
>>>oExcel = CreateObject("Excel.Application") 	
>>>
>>>
>>
>>If, by chance, you're doing that because Della and I did it in the Automation book, note that we say clearly that we using a public only for demo purposes. The truth is that a private variable declared and populated in your main program is sufficient, but I prefer to use a property, either of a dedicated automation object, or of the application object.
>>
>>Tamar
>
> Tamar, It was your book that allowed me to start automating excel. I am using different tabs and procedures because I use one procedure to, for instance, make one histogram showing numbers of A', the same procedure to make a pivot table, showing the # of A's per year, etc. What do you mean, where is it in your book, when you tablk about using a property of either a dedicated automation object or the application object. I missed this part, somehow. But your book is in front of me.
>
>Tore, I have not been releasing any variables that is once I start to work with the workbook but I will double check this.
>
>Greg Green, I can do this at the command line: ADDPROPERTY(_VFP, "oExcel", CreateObject("Excel.Application")), but I also see that if I type oExcel at the command line, intellisense does not recognize it? And a ?VARTYPE(oExcel) shows "U". How do you use: ADDPROPERTY(_VFP, "oExcel", CreateObject("Excel.Application")). Note, I added the missing closing ).
>
>Thank you to all, Steve

To make Intellisense work, you can use a variable.
ADDPROPERTY(_VFP, "oExcel", CreateObject("Excel.Application"))
oExcel = _vfp.oexcel
Also note the tip I gave you about using the debugger to see when oExcel is "lost".
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform