Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pivottable Object Model Question

Status
Not open for further replies.

Bygbobbo

Programmer
Apr 23, 2002
145
US
I am having a hard time finding a detailed object model for the pivottable component with a few examples. Has anyone worked with the activedata portion.

I am trying to enumerate through the record set to write the details to a .csv.

I think I am close but the problem is I can't find key words and Im guessing.

The following code goes through 1 aggregate only. I am currently looking for the nomenclature that will return the number of aggregates from the data area of the pivot table. The following is html for a quick and dirty extract which works:

Dim oPivot
Set oPivot = dialogArguments

Dim oData 'As PivotData
Dim oRow0 'As PivotMember -- First level Row Member
Dim oRow1 'As PivotMember -- Second Level Row Member
Dim oCol 'As PivotMember -- First level Column Member
Dim nCols
Dim sHTML
Dim CellValue
Dim c, r

Set oData = oPivot.ActiveData
'msgbox oData.Aggregates.Count
nCols = oData.ColumnMembers.Count

sHTML = &quot;<TABLE BORDER='1' WIDTH='100%' BORDERCOLOR='Gray' CELLSPACING=0>&quot; & vbCrLf & _
&quot;<COLGROUP SPAN='1' BGCOLOR='Silver'></COLGROUP>&quot; & vbCrLf & _
&quot;<COLGROUP SPAN='&quot; & nCols + 1 & &quot;' ALIGN='Right'></COLGROUP>&quot;
'Retrieve Column Member Captions.
sHTML = sHTML & vbCrLf & &quot; <TR><TD COLSPAN='1'> </TD>&quot;
For Each oCol In oData.ColumnMembers
sHTML = sHTML & &quot;<TD BGCOLOR='Silver'>&quot; & Trim(oCol.Caption) & &quot;</TD>&quot;
Next
sHTML = sHTML & vbCrLf & &quot; </TR>&quot;
'Retrieve Row Member Captions and Data Sets
For Each oRow0 In oData.RowMembers
sHTML = sHTML &&quot;<tr><td>&quot;&Trim(oRow0.Caption)&&quot;</td>&quot;
'msgbox Trim(oData.Cells(oRow0,oData.ColumnMembers(0)).Aggregates(0).Value)
'looping through data cells
For c = 0 To nCols - 1
sHTML = sHTML & &quot;<TD>&quot; & oData.Cells(oRow0, oData.ColumnMembers(c)).Aggregates(0).Value & &quot;</TD>&quot;
Next
sHTML = sHTML &&quot;</tr>&quot;
next

'This is the table closing tag.
sHTML = sHTML & vbCrLf & &quot;</TABLE>&quot;

document.body.innerHTML = sHTML


Any help would be greatly appreciated
Bygs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top