全部显示

MissingItemsLimit 属性

       

返回或设置每个数据透视表字段的唯一项的最大值,即使在缓存记录中没有支持数据,唯一项也能保留。XlPivotTableMissingItems 类型,可读写。

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