FANDOM


GeneralEdit

  • not strong data type
  • array start from 0, but the upper bound is one more than java array
  • concat string using "&"

VariablesEdit

  • Local: declare within a procedure. Dim, ReDim, Static
  • Module: placed in declaration section, apply to all procs within the module
  • Global: same as Module level but declared with global keyword

Data TypesEdit

Name Description

Type-Declaration Character

Range

Variant default data type. can be empty and it can hold other data type
Null variant value can be null if unknown or missing value.
Integer 2-byte % –32,768 to 32,767
Long 4-byte & –2,147,483,648 to 2,147,438,647
Single 4-byte float ! –3.402823E38 to 1.401298E-45 (negative
values)
1.401298E-45 to 3.402823E38 (positive
values)
Double 8-byte float # –1.79769313486232E308 to
–4.94065645841247E-324
(negative values)
4.94065645841247E-324 to
1.79769313486232E308
(positive values)
Currency 8-byte number with fixed decimal @@ –922337203685477.5808 to
922337203685477.5807
String

fixed length.

Dim temp as String * 50

$ 0-65400 characters
String variable length $ 0-2 billions characters.


  • Array: Array start from 0 by default. eg. Dim temp(4) as String -- declare array to hold 5 strings with temp[0] as the first element. Dim temp (1 To 50) as String -- hold 50 strings with temp[1] as the first element.
  • Multidimensional Array: Dim temp (10,5) as String
  • Dynamic Array: -- use ReDim, eg. ReDim temp(100)
  • Static variable: Static temp as String
  • Constant variable: Const temp = "my constant"

ReDim will clear existing values, to avoid use Preserve: ReDim Preserv temp(100)

  • User-Defined Type
Type Employee
    Name as String
    Address as String
End Type

Function and SubroutineEdit

  • Function does return value
[public | private] Function func1([ByVal|ByRef arg..] [,Optional arg]) As <return-data-type>
    ...
    [Exit Function] ' to exit prematurely
End Function
  • Subroutine does not return any value
[public | private] Sub sub1([args..])
...
End Sub

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.