Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Unable to set the visible property of the PivotItem class

Hi, All.

I'm trying to determine which items are visible in each visible field in a
PivotTable called ptSumGraph:

For Each fld In ptSumGraph.PivotFields
For Each vfld In ptSumGraph.VisibleFields
If vfld.Caption = fld.Caption Then
For Each itm In fld.PivotItems
itm.Visible = True
Next itm
End If
Next vfld
Next fld

The error hits at itm.Visible = True

I've seen some other posts where setting the field's AutoSort property to
Manual is suggested, but I still get the same error.

Thanks so much for your help!

Jim
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default Unable to set the visible property of the PivotItem class

Jim,

If the hidden item has been removed from the source data, you will get the
error when you try to make it visible. Try changing this line

itm.Visible = True

to this

If itm.RecordCount 0 Then itm.Visible = True

--
Hope that helps.

Vergel Adriano


"JimRWR" wrote:

Hi, All.

I'm trying to determine which items are visible in each visible field in a
PivotTable called ptSumGraph:

For Each fld In ptSumGraph.PivotFields
For Each vfld In ptSumGraph.VisibleFields
If vfld.Caption = fld.Caption Then
For Each itm In fld.PivotItems
itm.Visible = True
Next itm
End If
Next vfld
Next fld

The error hits at itm.Visible = True

I've seen some other posts where setting the field's AutoSort property to
Manual is suggested, but I still get the same error.

Thanks so much for your help!

Jim

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Unable to set the visible property of the PivotItem class

Vergel:

Thanks a bunch! Question - if I see that certain pivotitems in a field are
still tagged as hidden, that just means that there are no records
corresponding to those pivotitems? The error is gone, but I want to make
sure I'm getting the results I expect.

Thanks!

Jim

"Vergel Adriano" wrote:

Jim,

If the hidden item has been removed from the source data, you will get the
error when you try to make it visible. Try changing this line

itm.Visible = True

to this

If itm.RecordCount 0 Then itm.Visible = True

--
Hope that helps.

Vergel Adriano


"JimRWR" wrote:

Hi, All.

I'm trying to determine which items are visible in each visible field in a
PivotTable called ptSumGraph:

For Each fld In ptSumGraph.PivotFields
For Each vfld In ptSumGraph.VisibleFields
If vfld.Caption = fld.Caption Then
For Each itm In fld.PivotItems
itm.Visible = True
Next itm
End If
Next vfld
Next fld

The error hits at itm.Visible = True

I've seen some other posts where setting the field's AutoSort property to
Manual is suggested, but I still get the same error.

Thanks so much for your help!

Jim

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default Unable to set the visible property of the PivotItem class

Jim,

Yes, I believe the code would give you all items in the pivot table that has
at least one record in the source data. You might want to refresh the pivot
table first before going through the items. Also, I think you can do it with
just one for loop... give this one a try. It should give the same results as
your code

ptSumGraph.RefreshTable
For Each vfld In ptSumGraph.VisibleFields
For Each itm In vfld.PivotItems
itm.Visible = itm.RecordCount 0
Next itm
Next vfld


--
Hope that helps.

Vergel Adriano


"JimRWR" wrote:

Vergel:

Thanks a bunch! Question - if I see that certain pivotitems in a field are
still tagged as hidden, that just means that there are no records
corresponding to those pivotitems? The error is gone, but I want to make
sure I'm getting the results I expect.

Thanks!

Jim

"Vergel Adriano" wrote:

Jim,

If the hidden item has been removed from the source data, you will get the
error when you try to make it visible. Try changing this line

itm.Visible = True

to this

If itm.RecordCount 0 Then itm.Visible = True

--
Hope that helps.

Vergel Adriano


"JimRWR" wrote:

Hi, All.

I'm trying to determine which items are visible in each visible field in a
PivotTable called ptSumGraph:

For Each fld In ptSumGraph.PivotFields
For Each vfld In ptSumGraph.VisibleFields
If vfld.Caption = fld.Caption Then
For Each itm In fld.PivotItems
itm.Visible = True
Next itm
End If
Next vfld
Next fld

The error hits at itm.Visible = True

I've seen some other posts where setting the field's AutoSort property to
Manual is suggested, but I still get the same error.

Thanks so much for your help!

Jim

Reply
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
Error:Unable to set the visible property of the PivotItem class. Holger Pietsch Excel Programming 2 August 16th 05 05:11 PM
Unable to set NumberFormat property of the PivotField class Seb[_5_] Excel Programming 0 December 6th 04 03:50 PM
how to set pivotitem.visible property to true kanan Excel Programming 0 February 25th 04 08:06 PM
How can I set PivotItem.Visible property to True? yumi Excel Programming 2 February 19th 04 11:51 AM
Run-time error '1004' - Unable to set the Visible property of the Worksheet class Shalin Chopra Excel Programming 3 November 25th 03 08:38 PM


All times are GMT +1. The time now is 05:17 AM.

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

About Us

"It's about Microsoft Excel"