LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Excel Pivot Items Using C# - Unable to Access

I am working on a C# add-in that modifies pivot tables. I have done
this work in VBA, and the object model seems straightforward, e.g.,
PivotTable-PivotFields-PivotItems, but I can not get the object for
PivotItems, or iterate through the items. Do I need something other
than PivotItems?


Code for PivotFields, that works:

IExcel.PivotFields pvtfs = (IExcel.PivotFields)pvtTable.get_PageFields
(Missing.Value);
foreach (IExcel.PivotField pvtf in pvtfs)
{

Code for the does nto work, and PivotItems shows no values (as in
count):

IExcel.PivotItems pvtis = (IExcel.PivotItems)pvtf.PivotItems
(Missing.Value);
foreach (IExcel.PivotItem pvti in pvtis)
{

Similarly, even though I can iterate the CubeFields, I can not edit
some parameters, although I can retrieve its value, e.g., trying to
modify EnablemultiplePageitems throws an error:

IExcel.CubeFields cbfs = (IExcel.CubeFields)pvtTable.CubeFields;
foreach (IExcel.CubeField cbf in cbfs)
{
string cbfname = cbf.Name;
bool cbfMultiPage = cbf.EnableMultiplePageItems;

if (cbfname == dimensionName & cbfMultiPage == false)
{
cbf.EnableMultiplePageItems = true;
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to access visible property of Pivot Items class Geoff Excel Programming 2 May 21st 07 03:00 AM
Unable to access visible property of Pivot Items class Geoff Excel Programming 0 May 20th 07 10:20 PM
Unable to access Excel Help maztaz Excel Discussion (Misc queries) 0 May 9th 06 01:36 PM
Pivot Table unable to Include Hidden Items In Subtotals TC319 Excel Discussion (Misc queries) 1 March 21st 05 07:58 PM
Pivot Table unable to Include Hidden Items In Subtotals TC319 Charts and Charting in Excel 0 February 24th 05 08:53 PM


All times are GMT +1. The time now is 09:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"