返回或设置每个数据透视表字段的唯一项的最大值,即使在缓存记录中没有支持数据,唯一项也能保留。XlPivotTableMissingItems 类型,可读写。
XlPivotTableMissingItems 可为以下 XlPivotTableMissingItems 常量之一。 |
xlMissingItemsDefault 每个允许的数据透视表字段中唯一项的默认个数。 |
xlMissingItemsMax 每个允许的数据透视表字段中唯一项的最大个数 (32,500)。 |
xlMissingItemsNone 每个允许的数据透视表中没有唯一项(零)。 |
expression.MissingItemsLimit
expression 必需。该表达式返回一个 PivotCache 对象。
该属性的值可以介于 0 到 32500。如果指定一个小于零的整数,则其等价于指定 xlMissingItemsDefault。可以指定大于 32,500 的整数,但等价于指定 xlMissingItemsMax。
MissingItemsLimit 属性只用于非 OLAP 数据透视表,否则将出现运行错误。
本示例确定每个字段的唯一项的最大个数,并通知用户。本示例假定数据透视表位于活动工作表上。
Sub CheckMissingItemsList()
Dim pvtCache As PivotCache
Set pvtCache = Application.ActiveWorkbook.PivotCaches.Item(1)
' Determine the maximum number of unique items allowed per PivotField and notify the user.
Select Case pvtCache.MissingItemsLimit
Case xlMissingItemsDefault
MsgBox "The default value of unique items per PivotField is allowed."
Case xlMissingItemsMax
MsgBox "The maximum value of unique items per PivotField is allowed."
Case xlMissingItemsNone
MsgBox "No unique items per PivotField are allowed."
End Select
End Sub