| IPivotTable Properties |
| AutoFormatType |
Signature
[VBScript]
Property AutoFormatType As SAXlAutoFormatType (read/write)
Description
AutoFormatType applies one of Excel's built-in
PivotTable formats to the specified PivotTable. Set AutoFormatType
to an SAXlAutoFormatType value by name or number:
| SAXlAutoFormatType Values |
saxlAutoFormatNone
Setting AutoFormatType to
saxlAutoFormatNone disables
AutoFormatting in the generated PivotTable. | -1 |
saxlAutoFormatReport6 | 19 |
saxlAutoFormatClassic1 | 0 | saxlAutoFormatReport7 | 20 |
saxlAutoFormatClassic2 | 1 | saxlAutoFormatReport8 | 21 |
saxlAutoFormatTable1 | 2 | saxlAutoFormatReport9 | 22 |
saxlAutoFormatTable2 | 3 | saxlAutoFormatReport10 | 23 |
saxlAutoFormatTable3 | 4 | saxlAutoFormatReport11 | 24 |
saxlAutoFormatTable4 | 5 | saxlAutoFormatReport12 | 25 |
saxlAutoFormatTable5 | 6 | saxlAutoFormatReport13 | 26 |
saxlAutoFormatTable6 | 7 | saxlAutoFormatReport14 | 27 |
saxlAutoFormatTable7 | 8 | saxlAutoFormatReport15 | 28 |
saxlAutoFormatTable8 | 9 | saxlAutoFormatReport16 | 29 |
saxlAutoFormatTable9 | 10 | saxlAutoFormatReport17 | 30 |
saxlAutoFormatTable10 | 11 | saxlAutoFormatReport18 | 31 |
saxlAutoFormatTable11 | 12 | saxlAutoFormatReport19 | 32 |
saxlAutoFormatReport1 | 13 | saxlAutoFormatReport20 | 33 |
saxlAutoFormatReport2 | 14 | saxlAutoFormatReport21 | 34 |
saxlAutoFormatReport3 | 15 | saxlAutoFormatReport22 | 35 |
saxlAutoFormatReport4 | 17 | saxlAutoFormatReport23 | 36 |
saxlAutoFormatReport5 | 18 | saxlAutoFormatBlank | 37 |
To apply an AutoFormat in Excel:
- Select the PivotTable.
- Open the Format menu.
- Select AutoFormat...
Example
[VBScript]
pvtTable.AutoFormatType = saxlAutoFormatReport1
Top |
| DataCollectionInRow |
Signature
[VBScript]
Property DataCollectionInRow As Boolean (read/write)
Description
A data field contains values to be
summarized. By default, number values are summarized by the Sum function and text
values are summarized by the Count function. (To change the summarization type
set SummarizeBy.)
If a PivotTable contains more than one data field, a single field drop-down
named Data appears in the report for access to all of the data fields.
DataCollectionInRow determines whether the collection of
data fields will be displayed with the row or column fields.
Set this property if the PivotTable contains more than one data field.
 |
The Data button provides access to the data fields. |
Example
[VBScript]
pvtTable.DataCollectionInRow = True
Top |
| EmptyCellsValue |
Signature
[VBScript]
Property EmptyCellsValue As String (read/write)
Description
EmptyCellsValue sets a string to display
in empty cells in the PivotTable. The string will only be displayed if
ShowValueForEmptyCells is set
to true.
Example
[VBScript]
pvtTable.EmptyCellsValue = "N/A"
Top |
| EnableDrillDown |
Signature
[VBScript]
Property EnableDrillDown As Boolean (read/write)
Description
If EnableDrillDown is set to
true, the user will be able to:
- Select a cell in the PivotTable and click Show Detail
(on Excel's PivotTable toolbar) to display detailed source
data for the cell.
- Double-click the cell to display detailed source data for the
cell.
If EnableDrillDown is set to false, the
Show Detail button will be disabled.
Example
[VBScript]
pvtTable.EnableDrillDown = True
Top |
| EnableFieldDialog |
Signature
[VBScript]
Property EnableFieldDialog As Boolean (read/write)
Description
EnableFieldDialog enables or disables
Excel's PivotTable Field dialog for the specified PivotTable in the
generated spreadsheet. If the property is set to true,
the user will be able to right-click within the PivotTable and select
Field Settings to open the dialog. If the EnableFieldDialog
is set to false Field Settings will be disabled.
Example
[VBScript]
pvtTable.EnableFieldDialog = True
Top |
| EnableWizard |
Signature
[VBScript]
Property EnableWizard As Boolean (read/write)
Description
EnableWizard enables or disables:
- Excel's PivotTable and PivotChart Wizard for the
specified PivotTable, and
- Excel's PivotTable Options dialog for the specified PivotTable.
If EnableWizard is set to
false, the user will not be able to select the PivotTable and open the
wizard, or right-click the table and select Table Options...
Example
[VBScript]
pvtTable.EnableWizard = True
Top |
| Fields |
Signature
Description
Fields returns the collection of
IPivotFields in the specified
PivotTable. An IPivotField represents a PivotTable field.
Example
[VBScript]
'--- The Fields collection is populated automatically
'--- based on the range of data passed to the CreatePivotTable
'--- method.
Set fldProduct = pvtTable.Fields("Product")
'--- Product name will be displayed across the top.
fldProduct.Type = saxlPivotFieldColumn
Top |
| FieldsPerPage |
Signature
[VBScript]
Property FieldsPerPage As Long (read/write)
Description
If PageLayout
is set to saxlOverThenDown, FieldPerPage
sets the number of page fields in each row in the PivotTable.
If PageLayout
is set to saxlDownThenOver, FieldPerPage
sets the number of page fields in each column in the PivotTable.
Example
[VBScript]
pvtTable.FieldsPerPage = 7
Top |
| FriendlyErrorValue |
Signature
[VBScript]
Property FriendlyErrorValue As String (read/write)
Description
FriendlyErrorValue replaces error
values in the PivotTable with the specified string. The friendly error
string will be displayed only if
ShowFriendlyErrorValue
is set to true.
Example
[VBScript]
pvtTable.FriendlyErrorValue = "N/A"
Top |
| GrandTotalsForColumns |
Signature
[VBScript]
Property GrandTotalsForColumns As Boolean (read/write)
Description
If GrandTotalsForColumns is set to
true, grand totals for each of the columns will be displayed in
the PivotTable. If the property is set to false, grand totals for each
of the columns will not be displayed.
Example
[VBScript]
pvtTable.GrandTotalsForColumns = True
Top |
| GrandTotalsForRows |
Signature
[VBScript]
Property GrandTotalsForRows As Boolean (read/write)
Description
If GrandTotalsForRows is set to
true, grand totals for each of the rows will be displayed in
the PivotTable. If the property is set to false, grand totals for each
of the rows will not be displayed.
Example
[VBScript]
pvtTable.GrandTotalsForRows = True
Top |
| InOutlineForm |
Signature
[VBScript]
Property InOutlineForm As Boolean (read/write)
Description
InOutlineForm specifies whether to display the PivotTable in outline form or
in tabular form.
Example
[VBScript]
pvtTable.InOutlineForm = true
Top |
| MergeLabels |
Signature
[VBScript]
Property MergeLabels As Boolean (read/write)
Description
Set MergeLabels to true
to center PivotTable labels vertically and horizontally.
Example
[VBScript]
pvtTable.MergeLabels = True
Top |
| Name |
Signature
[VBScript]
Property Name As String (read/write)
Description
Use Name to set a name for the
PivotTable. In Excel the name is displayed in the Pivot Table
Options dialog (right-click the PivotTable and select
Table Options...). Using the property
IPivotTables.Item, you can use
the value of Name to reference a specific PivotTable
in code.
Example
[VBScript]
pvtTable.Name = "Sales Report 2003"
Top |
| PageLayout |
Signature
[VBScript]
Property PageLayout As SAXlOrder (read/write)
Description
Set PageLayout to control the order in which
the PivotTable is printed when it does not fit on one page.
Set PageLayout to an SAXlOrder value
by name or number:
| SAXlOrder Values |
saxlDownThenOver | 1 |
saxlOverThenDown | 2 |

Example
[VBScript]
pvtTable.PageLayout = saxlOverThenDown
Top |
| PreserveFormatting |
Signature
[VBScript]
Property PreserveFormatting As Boolean (read/write)
Description
If PreserveFormatting is set to true,
most PivotTable formatting will be preserved when you change the report
layout or refresh the data. Cell border changes are not preserved.
Example
[VBScript]
pvtTable.PreserveFormatting = True
Top |
| RepeatItemLabels |
Signature
[VBScript]
Property RepeatItemLabels As Boolean (read/write)
Description
If RepeatItemLabels is set to
true, PivotTable item labels will be repeated on each printed page.
Example
[VBScript]
pvtTable.RepeatItemLabels = True
Top |
| SetPrintTitles |
Signature
[VBScript]
Property SetPrintTitles As Boolean (read/write)
Description
To display the PivotTable's row and column labels as print
titles, set SetPrintTitles to true.
Print titles are row or column labels that are displayed at the top
or left side of each printed page.
SetPrintTitles will not take effect if
Rows to repeat at top or Columns to
repeat at left is set. To make sure that these
settings are clear:
- Open the File menu and select Page Setup...
- Select the Sheet tab.
- Clear the Rows to repeat at top and Columns to
repeat at left fields.
Example
[VBScript]
pvtTable.SetPrintTitles = True
Top |
| ShowFriendlyErrorValue |
Signature
[VBScript]
Property ShowFriendlyErrorValue As Boolean (read/write)
Description
If ShowFriendlyErrorValue is set
to true, the value set by FriendlyErrorValue
will replace error values in the PivotTable.
Example
[VBScript]
pvtTable.ShowFriendlyErrorValue = True
Top |
| ShowValueForEmptyCells |
Signature
[VBScript]
Property ShowValueForEmptyCells As Boolean (read/write)
Description
If ShowValueForEmptyCells is set
to true, the value set by EmptyCellsValue
will be displayed in empty cells in the PivotTable.
Example
[VBScript]
pvtTable.ShowValueForEmptyCells = True
Top |
| SubtotalHiddenPageItems |
Signature
[VBScript]
Property SubtotalHiddenPageItems As Boolean (read/write)
Description
If SubtotalHiddenPageItems is set
true, hidden page items will be included in totals.
Example
[VBScript]
pvtTable.SubtotalHiddenPageItems = True
Top |
| UpperLeftColumn |
Signature
[VBScript]
Property UpperLeftColumn As Long (read/write)
Description
Sets or returns the PivotTable's upper
left column number.
Example
[VBScript]
pvtTable.UpperLeftColumn = 7
Top |
| UpperLeftRow |
Signature
[VBScript]
Property UpperLeftRow As Long (read/write)
Description
Sets or returns the PivotTable's upper
left row number.
Example
[VBScript]
pvtTable.UpperLeftRow = 7
Top
|