XL5: Error:"Unable to Set Visible Property PivotItem class"

Last reviewed: September 2, 1997
Article ID: Q114822
The information in this article applies to:
  • Microsoft Excel for Windows, version 5.0

SYMPTOMS

When you run a recorded Visual Basic, Applications Edition, macro to set up a pivot table in which discontiguous items are hidden in the PivotTable Field dialog box, you may receive the following error message:

   Unable to set the Visible property of the PivotItem class

CAUSE

Only contiguous items in a PivotTable Field can be hidden.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem was corrected in Microsoft Excel for Windows version 5.0c.

WORKAROUND

To work around this problem, remove or disable (use an apostrophe to comment out) the line or lines that set the visible property of discontiguous items in the field to False; removing or disabling this line will allow your macro to run successfully.

For example, in the following code, you would comment out the fourth line down to disable the code that causes the error:

   With ActiveSheet.PivotTables("PivotTable1").PivotFields("field1")
        .PivotItems("1").Visible = False
        .PivotItems("2").Visible = False
       '.PivotItems("7").Visible = False
   End With


Additional query words: 5.00 Hiding Fields
Keywords : kbprg PgmOthr kbcode kbprb
Version : 5.00
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 2, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.