Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
OLE automation Excel - how to handle spaces?
Message
De
10/07/1998 21:46:17
Arnold Lee
K&A International Co.,Ltd
Hong Kong, Hong Kong
 
 
À
10/07/1998 15:57:45
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00102943
Message ID:
00116407
Vues:
19
>>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
Fil
Voir

Click here to load this message in the networking platform