Page 382 - Microsoft Office Excel 2003 Programming Inside Out
P. 382

Part 5:  Manipulating Excel Objects
                                        Microsoft Office Excel 2003 Programming Inside Out

                    PivotItem Object
                             The PivotItem object represents a single, specific value for a particular PivotField object. Table
                             16-6 contains a list of the key properties and methods associated with the PivotItem object.
                             Table 16-6.  Key Properties and Methods of the PivotItem Object

                             Property/Method       Description
                             Caption               Property (read-only): returns the label text for the field.
                             DataRange	            Property (read-only): returns a Range object with the data
                                                   contained in the field.
                             Formula	              Property: contains the formula associated with the item in A1-
                                                   style notation. If the cell is empty, an empty string will be
                                                   returned. If the cell contains a constant, the constant will be
                                                   returned.
                             LabelRange	           Property (read-only): returns the Range object representing the
                                                   cells in the PivotTable report that contain the item.
                             Name                  Property: contains the name of the PivotItem object.
                             Position	             Property: contains the relative position of the field within its
                                                   orientation.
                             RecordCount	          Property (read-only): returns the number of records in the
                                                   PivotCache containing the specified item.
                             Value	                Property: contains the name of the specified item in the
                                                   PivotTable field.
                             Visible               Property: when True, means that the item is visible.

                    Programming PivotTables
             Chapter 16
                             Programming PivotTables involves creating the appropriate PivotCache object and then
                             using the PivotCache object to create a PivotTable object. Once the PivotTable object is avail-
                             able, you can modify its properties to view the data from different positions.

                             Tip  Make Things Easy on Yourself
                             Creating PivotTables can be difficult, so you might want to fall back on the standard macro
                             writer’s trick: record a new macro using the commands necessary to perform the task you
                             wish to program, and then use the recorded code as the basis of your new program. This
                             trick is extremely useful when dealing with complex object models such as those used by
                             Excel to manipulate PivotTables.









                356
   377   378   379   380   381   382   383   384   385   386   387