PC Review


Reply
Thread Tools Rate Thread

Deleting PivotFields From PivotCharts in VB.NET

 
 
=?Utf-8?B?UmVmcmVzaGVy?=
Guest
Posts: n/a
 
      14th Mar 2007
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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting PivotFields from a PivotChart in VB.NET =?Utf-8?B?UmVmcmVzaGVy?= Microsoft Excel Charting 0 14th Mar 2007 08:10 PM
PivotFields problem =?Utf-8?B?VGlt?= Microsoft Excel Programming 3 17th Nov 2005 05:33 PM
PivotFields =?Utf-8?B?TmVhbA==?= Microsoft Excel Programming 2 20th Sep 2004 07:33 PM
Combining 2 Pivotfields to 1(Help!!!) Billabong Microsoft Excel Programming 0 25th Aug 2004 10:18 AM
Pivotfields.CurrentPage Daniel Magnus Bennét Björck Microsoft Excel Programming 7 7th Feb 2004 03:24 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:22 PM.