DataType Property

Applies To

Parameter object, PivotField object.

Description

PivotField object: Returns a constant describing the type of data in the pivot field. Can be one of the following XlPivotFieldDataType constants: xlText, xlNumber, or xlDate. Read-only Long.

Parameter object: Returns or sets the data type of the specified query parameter. Read/write Long.

Can be one of the following XlParameterDataType constants:

  • xlParamTypeBigInt
  • xlParamTypeBinary
  • xlParamTypeBit
  • xlParamTypeChar
  • xlParamTypeDate
  • xlParamTypeDecimal

  • xlParamTypeDouble
  • xlParamTypeFloat
  • xlParamTypeInteger
  • xlParamTypeLongVarBinary
  • xlParamTypeLongVarChar
  • xlParamTypeNumeric
  • xlParamTypeReal
  • xlParamTypeSmallInt
  • xlParamTypeTime
  • xlParamTypeTimeStamp
  • xlParamTypeTinyInt
  • xlParamTypeUnknown
  • xlParamTypeVarBinary
  • xlParamTypeVarChar

Example

This example displays the data type of the field named "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