Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Excel PivotTable Problems...
Message
 
À
09/02/2001 12:18:37
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00474499
Message ID:
00474612
Vues:
15
Pass a array for reference.
Try:
DIME Cic(n), Date(m), Maincic(l)
Cic(1) = "Your_Column_Name"
Cic(2) = "Your_Column_Name"
...
Cic(n) = "Your_Column_Name"

Date(1) = "Your_Column_Name"
Date(2) = "Your_Column_Name"
...
Date(m) = "Your_Column_Name"

Maincic(1) = "Your_Column_Name"
Maincic(2) = "Your_Column_Name"
...
Maincic(l) = "Your_Column_Name"
...
oPivotTable.AddFields(@Cic,@Date,@Maincic)
...
>When I run the code below I am getting an error on this line of code:
>
> oPivotTable.AddFields("Cic ", "Date ", "Maincic")
>
>The error returned is as follows:
>
> OLE IDispatch exception code 0 from Excel. Unable to get the
> AddFields property of the PivotTable class.
>
>I am using Excel 2000 and VFP 6 SP3 under NT 4.0 following the concepts used in the Office Automation w/ VFP book. Specifically I am following pages 192 - 193.
>
>Any help will be greatly appreciated.
>
>
>#DEFINE xlDatabase 1
>#DEFINE xlDataField 4
>USE cdata
>*-- Layout it as follows:
>*-- Date (D), CIC I, Maincic C(20), Amt I
>Application.DataToClip(,,3)
>LastLine = ALLTRIM(STR(RECCOUNT('cdata')+1))
>
>oExcel = CREATEOBJECT("Excel.Application")
>
>WITH oExcel
> .Visible = .T.
> .WorkBooks.Add()
>
> .ActiveSheet.Name = 'CFPivot'
> .Sheets(2).Activate
> .ActiveSheet.Name = 'CFRawData'
> .Selection.Range("A1").Select()
> .ActiveSheet.Paste()
>
> oSourceData = .Sheets("CFRawData").Range("A1:D"+LastLine)
> oDestination = .Sheets("CFPivot").Range("A3")
>
> oPivotTable = .Sheets("CFRawData").PivotTableWizard(xlDatabase, ;
> oSourceData, oDestination, "CashFlow", .T., .T.)
>
>*-- Problem is here
> oPivotTable.AddFields("Cic ", "Date ", "Maincic")
>
> oPivotTable.PivotFields("Amt").Orientation = xlDataField
> .ActiveSheet.PivotTables("CashFlow").PivotFields( ;
> "Sum of Amt").NumberFormat = "$#,##0);[Red]($#,##0)"
>ENDWITH
Luis María Guayán
Tucumán, Argentina
________________________________
SysOp de www.PortalFox.com
Nada corre como un zorro
________________________________
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform