+ Reply to Thread
Results 1 to 3 of 3

Error:Unable to set the visible property of the PivotItem class.

Hybrid View

  1. #1
    Holger Pietsch
    Guest

    Error:Unable to set the visible property of the PivotItem class.

    I got the error
    Unable to set the visible property of the PivotItem class.

    when i try to set a pivotitem to visible:
    Dim PF As PivotField
    Dim PFI As PivotItem
    For Each PF In PFs
    Set PFs = ActiveSheet.PivotTables("PivotTable2").PivotFields
    For Each PFI In PF.HiddenItems
    PFI.Visible = True
    Next PFI
    Next PF

    is there any solution, I have found yet no such (only at
    http://www.experts-exchange.com/msof..._20275761.html
    , but they wanted me to register first...)

    Thanks
    Holger

  2. #2
    Tom Ogilvy
    Guest

    Re: Error:Unable to set the visible property of the PivotItem class.

    See Debra Dalgleish's site

    http://www.contextures.com/xlPivot03.html

    Note that in her sample code she sets the autosort to manula before
    unhidding the item, so this must be some bug she is allowing for:

    Sub PivotShowItemAllVisible()
    'sort is set to Manual to prevent errors, e.g.
    'unable to set Visible Property of PivotItem class
    Dim pt As PivotTable
    Dim pf As PivotField
    Dim pi As PivotItem
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False
    On Error Resume Next
    For Each pt In ActiveSheet.PivotTables
    For Each pf In pt.RowFields
    pf.AutoSort xlManual, pf.SourceName
    For Each pi In pf.PivotItems
    pi.Visible = True
    Next pi
    pf.AutoSort xlAscending, pf.SourceName
    Next pf
    Next pt
    Application.DisplayAlerts = True
    Application.ScreenUpdating = True
    End Sub
    -- Regards,Tom Ogilvy
    "Holger Pietsch" <HolgerPietsch@discussions.microsoft.com> wrote in message
    news:CE078895-4E8E-4523-A540-897DFEBAC7A8@microsoft.com...
    > I got the error
    > Unable to set the visible property of the PivotItem class.
    >
    > when i try to set a pivotitem to visible:
    > Dim PF As PivotField
    > Dim PFI As PivotItem
    > For Each PF In PFs
    > Set PFs = ActiveSheet.PivotTables("PivotTable2").PivotFields
    > For Each PFI In PF.HiddenItems
    > PFI.Visible = True
    > Next PFI
    > Next PF
    >
    > is there any solution, I have found yet no such (only at
    > http://www.experts-exchange.com/msof..._20275761.html
    > , but they wanted me to register first...)
    >
    > Thanks
    > Holger




  3. #3
    Holger Pietsch
    Guest

    Re: Error:Unable to set the visible property of the PivotItem clas

    Hi Tom,

    the example works fine. I am now trying to get my stuff running.

    Thanks a lot.
    Holger

    "Tom Ogilvy" wrote:

    > See Debra Dalgleish's site
    >
    > http://www.contextures.com/xlPivot03.html
    >
    > Note that in her sample code she sets the autosort to manula before
    > unhidding the item, so this must be some bug she is allowing for:
    >
    > Sub PivotShowItemAllVisible()
    > 'sort is set to Manual to prevent errors, e.g.
    > 'unable to set Visible Property of PivotItem class
    > Dim pt As PivotTable
    > Dim pf As PivotField
    > Dim pi As PivotItem
    > Application.ScreenUpdating = False
    > Application.DisplayAlerts = False
    > On Error Resume Next
    > For Each pt In ActiveSheet.PivotTables
    > For Each pf In pt.RowFields
    > pf.AutoSort xlManual, pf.SourceName
    > For Each pi In pf.PivotItems
    > pi.Visible = True
    > Next pi
    > pf.AutoSort xlAscending, pf.SourceName
    > Next pf
    > Next pt
    > Application.DisplayAlerts = True
    > Application.ScreenUpdating = True
    > End Sub
    > -- Regards,Tom Ogilvy
    > "Holger Pietsch" <HolgerPietsch@discussions.microsoft.com> wrote in message
    > news:CE078895-4E8E-4523-A540-897DFEBAC7A8@microsoft.com...
    > > I got the error
    > > Unable to set the visible property of the PivotItem class.
    > >
    > > when i try to set a pivotitem to visible:
    > > Dim PF As PivotField
    > > Dim PFI As PivotItem
    > > For Each PF In PFs
    > > Set PFs = ActiveSheet.PivotTables("PivotTable2").PivotFields
    > > For Each PFI In PF.HiddenItems
    > > PFI.Visible = True
    > > Next PFI
    > > Next PF
    > >
    > > is there any solution, I have found yet no such (only at
    > > http://www.experts-exchange.com/msof..._20275761.html
    > > , but they wanted me to register first...)
    > >
    > > Thanks
    > > Holger

    >
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1