断数据类型的函数,不同于VarType() 函数,VarType() 函数返回的是 integer型值,这个函数返回的是字符串。
Public Function getDataType(v As Variant) As String
Select Case VarType(v)
Case vbArray
getDataType = " vbArray"
Case vbBoolean
getDataType = " vbBoolean"
Case vbByte
getDataType = " vbByte"
Case vbCurrency
getDataType = " vbCurrency"
Case vbDataObject
getDataType = " vbDataObject"
Case vbDate
getDataType = " vbDate"
Case vbDecimal
getDataType = " vbDecimal"
Case vbDouble
getDataType = " vbDouble"
Case vbEmpty
getDataType = " vbEmpty"
Case vbError
getDataType = " vbError"
Case vbInteger
getDataType = " vbInteger"
Case vbLong
getDataType = " vbLong"
Case vbNull
getDataType = " vbNull"
Case vbObject
getDataType = " vbObject"
Case vbSingle
getDataType = " vbSingle"
Case vbString
getDataType = " vbString"
Case vbUserDefinedType
getDataType = " vbUserDefinedType"
Case vbVariant
getDataType = " vbVariant"
Case Else
getDataType = "Unknown Data Type"
End Select
End Function
Public Function getDataType(v As Variant) As String
Select Case VarType(v)
Case vbArray
getDataType = " vbArray"
Case vbBoolean
getDataType = " vbBoolean"
Case vbByte
getDataType = " vbByte"
Case vbCurrency
getDataType = " vbCurrency"
Case vbDataObject
getDataType = " vbDataObject"
Case vbDate
getDataType = " vbDate"
Case vbDecimal
getDataType = " vbDecimal"
Case vbDouble
getDataType = " vbDouble"
Case vbEmpty
getDataType = " vbEmpty"
Case vbError
getDataType = " vbError"
Case vbInteger
getDataType = " vbInteger"
Case vbLong
getDataType = " vbLong"
Case vbNull
getDataType = " vbNull"
Case vbObject
getDataType = " vbObject"
Case vbSingle
getDataType = " vbSingle"
Case vbString
getDataType = " vbString"
Case vbUserDefinedType
getDataType = " vbUserDefinedType"
Case vbVariant
getDataType = " vbVariant"
Case Else
getDataType = "Unknown Data Type"
End Select
End Function