返回或设置 Boolean,用于指明当数据透视表的数据区域为空时,行和列区域中的项是否可见。如果该属性为 False,则当数据透视表的数据区域为空时,将隐藏行和列区域中的项。默认值为 True。
expression.DisplayImmediateItems
expression 必需。该表达式返回一个 PivotTable 对象。
本示例确定如何创建数据透视表并通知用户。本示例假定数据透视表位于活动的工作表上。
Sub CheckItemsDisplayed()
Dim pvtTable As PivotTable
Set pvtTable = ActiveSheet.PivotTables(1)
' Determine how the PivotTable was created.
If pvtTable.DisplayImmediateItems = True Then
MsgBox "Fields have been added to the row or column areas for the PivotTable report."
Else
MsgBox "The PivotTable was created by using object-model calls."
End If
End Sub