TypeName Function; VarType Function/text/sbasic/shared/03103600.xhpTypeName functionVarType functionBasic Variable Type constants
TypeName Function; VarType Function
Returns a string (TypeName) or a numeric value (VarType) that contains information for a variable.TypeName (Variable) / VarType (Variable)String; IntegerVariable: The variable that you want to determine the type of. You can use the following values:
KeywordNamed constantVarTypeVariable typeBoolean11Boolean variableByte17Byte variableDateV_DATE7Date variableCurrencyV_CURRENCY6Currency variableDoubleV_DOUBLE5Double floating point variableIntegerV_INTEGER2Integer variableLongV_LONG3Long integer variableObject9Object variableSingleV_SINGLE4Single floating-point variableStringV_STRING8String variableVariant12Variant variable (can contain all types specified by the definition)EmptyV_EMPTY0Variable is not initializedNullV_NULL1No valid data
Sub ExampleTypeDim iVar As IntegerDim sVar As StringDim siVar As SingleDim dVar As DoubleDim bVar As BooleanDim lVar As LongDim cVar as CurrencyDim tVar as Date MsgBox TypeName(iVar) & " " & VarType(iVar) & Chr(13) &_ TypeName(sVar) & " " & VarType(sVar) & Chr(13) &_ TypeName(siVar) & " " & VarType(siVar) & Chr(13) &_ TypeName(dVar) & " " & VarType(dVar) & Chr(13) &_ TypeName(bVar) & " " & VarType(bVar) & Chr(13) &_ TypeName(cVar) & " " & VarType(cVar) & Chr(13) &_ TypeName(tVar) & " " & VarType(tVar) & Chr(13) &_ TypeName(lVar) & " " & VarType(lVar),0,"Some types In $[officename] Basic"End Sub