Contido
Índice 🔎︎

# TypeName Function; VarType Function

Devolve unha cadea (TypeName) ou un valor numérico (VarType) que contén información para unha variábel.

### Sintaxe:

    TypeName (Variable) / VarType (Variable)

### Valor de retorno:

String; Integer

### Parámetros:

Variable: The variable that you want to determine the type of. You can use the following values:

Keyword | Named constant | VarType | Tipos de variábeis
--- | --- | --- | ---
Boolean |  | 11 | Variábeis booleanas
Byte |  | 17 | Byte variable
Date | V_DATE | 7 | Variábeis de data
Currency | V_CURRENCY | 6 | Currency variable
Double | V_DOUBLE | 5 | Double floating point variable
Integer | V_INTEGER | 2 | Variábeis enteiras
Long | V_LONG | 3 | Variábeis enteiras longas
Object |  | 9 | Object variable
Single | V_SINGLE | 4 | Single floating-point variable
String | V_STRING | 8 | Variábeis de cadea
Variant |  | 12 | Variant variable (can contain all types specified by the definition)
Empty | V_EMPTY | 0 | Variábel non iniciada
Null | V_NULL | 1 | Sen datos válidos

### Códigos de erro

5 Chamada de procedemento incorrecta

### Exemplo:

    Sub ExampleType
    Dim iVar As Integer
    Dim sVar As String
    Dim siVar As Single
    Dim dVar As Double
    Dim bVar As Boolean
    Dim lVar As Long
    Dim cVar as Currency
    Dim 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,"Algúns tipos no Basic do LibreOffice"
    End Sub