Text Documents (Writer)
HTML Documents (Writer Web)
Spreadsheets (Calc)
Presentations (Impress)
Drawings (Draw)
Database Functionality (Base)
Formulae (Math)
Charts and Diagrams
Macros and Scripting
Office Installation
Common Help Topics
OneOffice Logo

Type Statement

Define non-UNO data structures.

A Type structure is an ordered collection of data fields, that can be manipulated as a single item.

Syntax:

Type statement diagram


         Type struct-name
             DataField1 As TypeName1
             DataField2 As TypeName2
             (...)
         End Type ' struct-name
     
array fragment

array fragment


      ( [[start To] end], .. )
    
Parameters

start: Lower bound of a dimension.

end: Upper bound of a dimension.

Multiple dimensions for an array are denoted using comma (,) sign.

typename fragment

primitive data types fragment


      {Boolean|Byte|Currency|Date|Double|Integer|Long|Object|Single|String|Variant}
    

Extended types such as Type statement structures, UNO objects or ClassModule objects are valid typenames.

char fragment

type declaration characters


      { % | & | ! | # | $ | @ }
    

A Type structure scope is that of the module it belongs to.

Example:


         Type Customer
             Name1 As String
             City As String
         End Type ' Customer structure
         Sub setCustomer
             Dim oCustomer as New Customer
             oCustomer.Name1 = "The Document Foundation"
             oCustomer.City = "Berlin"
         End Sub
     

Enumerations can be created using Type statement definitions. Calling Python Scripts from Basic illustrates that mechanism.