Information générale
Catégorie:
Codage, syntaxe et commandes
>>But if I want to pass parameter from VFP to Excel in array format,like ARRAY("Sheet1","Sheet2"),how can I do that ?
>>I had try using your suggestion but doesn't work,would you pls give me any >advise about that
>
>I think I understand what you are after. FoxPro has 3 pairs of delimiters for character expressions: single quotes, double quotes and brackets. So you can create character expressions that contain character expressions that contain quotes. You could enclose your expression in single quotes or brackets.
>
>Example:
>oExcel.SomeCommand('SomeFunction("some text", "other text")')
>
>HIH
Hi,Pamela
Thanks for your input.My OLE code between VFP & Excel as follow...
RELEASE OEXCEL && release any created Excel object
PUBLIC OEXCEL && made it public so I can test it in command window
OEXCEL=CREATEOBJ("EXCEL.SHEET.8") && create Excel sheet
WITH OEXCEL.APPLICATION
.SCREENUPDATING = .F. && scppress flashes of screen
.CALCULATION = 3 && for optimization
.WORKBOOKS.OPEN("C:\VFP\TMPFILES\PL.XLS") && open a VFP generated Excel file
.WORKBOOKS("PL").SHEETS(1).MOVE(.WORKBOOKS(OEXCEL.NAME).SHEETS(1)) && move data to Excel object
WITH .WORKBOOKS(OEXCEL.NAME).SHEETS("PL")
.ACTIVATE
.RANGE("A1").CURRENTREGION.SUBTOTAL(1,1,"ARRAY(4,6)",.T.,.F.,.T.) && problem line !!!
ENDWITH
.CALCULATION=1 && rest calculation to auto
.SCREENUPDATING=.T. && refresh Excel screen
.VISIBLE=1 && made Excel visible
ENDWITH
The word "Array" in my discussion may be confusing.
"Array()" is a Excel function that groups something together like "SETALL()" in VFP,
Excel syntax is ARRAY(parameter1,parameter2,parameter3...)
In my case,I want to group data to forms total as group changes,just like define group in report writer of VFP.But I found that Excel offer similiar function that group by one particular column then do the calculation as SUBTOTAL(),but I can't pass series of column for calculation to Excel array function,like ARRAY(4,6),calculating column 4 AND 6.
If I replace Array(4,6) with 4 in problem line it works fine like...
.RANGE("A1").CURRENTREGION.SUBTOTAL(1,1,4,.T.,.F.,.T.)
But calculation only applied on column 4.
Also,I had try you suggestion "Array('4,6')",Unfortunatly,it doesn't work.
My point is how to pass Excel recognized parameter in VFP.
Thanks for any advise in advance.
Arnold
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