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: 10
Default Deleting PivotFields From PivotCharts in VB.NET

Hi,
I keep getting an Exception from HRESULT: 0x800A03EC when trying to delete
unneeded PivotFields from my PivotChart. The code I am using is below. Any
thoughts as to why I get an Exception? Any advice on how I can get this to
work?
Thanks.

Dim field As String
Dim pivFields As Excel.PivotFields =
CType(CType(xlWs2.PivotTables("PivotTable1"), Excel.PivotTable).PivotFields,
Excel.PivotFields)

For Each pivField As Excel.PivotField In pivFields
field = pivField.Name
If field < "Serial Number" And field < PivotData And field < PivotRow
And field < PivotColumn And Not lstXGrouping.Items.Contains(field) And Not
lstSeriesGrouping.Items.Contains(field) Then

For Each pivItem As Excel.PivotItem In pivField.PivotItems
pivItem.Delete()
Next
End If
Next

 
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
PivotTable - PivotFields VBA Hutch Excel Discussion (Misc queries) 0 June 18th 08 09:03 PM
Deleting PivotFields from a PivotChart in VB.NET Refresher Charts and Charting in Excel 0 March 14th 07 08:10 PM
PivotFields problem Tim Excel Programming 3 November 17th 05 05:33 PM
PivotFields Neal Excel Programming 2 September 20th 04 07:23 PM
Pivotfields.CurrentPage Daniel Magnus Bennét Björck Excel Programming 5 February 6th 04 02:48 PM


All times are GMT +1. The time now is 11:33 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"