Excel) (PivotField.DataType 属性

返回表示数据透视表字段中数据类型的 XlPivotFieldDataType 值。

语法

表达式。数据类型

表达式 表示 PivotField 对象的变量。

示例

此示例显示名为 ORDER_DATE 的字段的数据类型。

Set pvtTable = Worksheets("Sheet1").Range("A3").PivotTable 
Select Case pvtTable.PivotFields("ORDER_DATE").DataType 
 Case Is = xlText 
 MsgBox "The field contains text data" 
 Case Is = xlNumber 
 MsgBox "The field contains numeric data" 
 Case Is = xlDate 
 MsgBox "The field contains date data" 
End Select

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。