Terms
arglist
[ | expr | param:=expr ][, ...]
A list of zero
or more exprs that are assigned to the parameters of the
procedure.
• A positional parameter may be skipped by omitting the expression. Only optional parameters may be skipped.
• Positional parameter assignment is done with expr. Each parameter is assigned in turn. By name parameter assignment may follow.
• By name parameter assignment is done with param:=expr. All following parameters must be assigned by name.
arrayvar A variable that holds an array of values. A Variant variable can hold an array. Dynamic arrays can be ReDimensioned.
As [New] type
As type
-or-
As New objtype
Dim,
Private, Public and Static statements may declare variable
types using As type or As New objtype. A variable declared using
As New objtype is automatically created prior to use, if the variable is
Nothing.
As type Variable and parameter types, as well as, function and property results may be specified using As type: Boolean, Byte, Currency, Date, Decimal, Double, Huge_, Integer, Long, Object, PortInt, SByte, Single, String, String*n, UHuge_, Variant, objtype, user delegate, user dialog, user enum, user type.
attribute A file attribute is zero or more of the following values added together.
Attribute Value Description
vbNormal 0 Normal file.
vbReadOnly 1 Read-only file.
vbHidden 2 Hidden file.
vbSystem 4 System file.
vbVolume 8 Volume label.
vbDirectory 16 MS-DOS directory.
vbArchive 32 File has changes since last backup.
vbAlias 64 File is an alias.
big-endian Multiple byte data values (not strings) are stored with the highest order byte first. For example, the long integer &H01020304 is stored as this sequence of four bytes: &H01, &H02, &H03 and &H04. A Binary or Random file written using Put uses little-endian format so that it can be read using Get on any machine. (Big-endian machines, like the Power-PC, reverse the bytes as they are read by Get or written by Put.)
bytearray A variable that holds an array of byte values.
caseexpr An expression which specifies a single value or a range. Refer to the Select Case statement.
charlist A group of one or more characters enclosed by [ ] as part of Like operator's right string expression.
• This list contains single characters and/or character ranges which describe the characters in the list.
• A range of characters is indicated with a hyphen (-) between two characters. The first character must be ordinally less than or equal to the second character.
• Special pattern characters like ?, *, # and [ can be matched as literal characters.
• The ] character can not be part of charlist, but it can be part of the pattern outside the charlist.
condexpr An expression that returns a numeric result. If the result is zero then the conditional is False. If the result is non-zero then the conditional is True.
0 'false
-1 'true
X > 20 'true if X is
greater than 20
S$ = "hello" 'true if S$
equals "hello"
dateexpr An expression that returns a date result. Use #literal-date# to express a date value.
#1/1/2000# ' Jan 1,
2000
Now+7 ' seven days from
now
DateSerial(Year(Now)+1,Month(Now),Day(Now))
' one year
from now
dialogfunc A dialog function executes while a user dialog is visible.
dimension
[lower To] upper
Array dimension. If lower is
omitted then the lower bound is zero or one depending on the Option Base
setting. (The lower bound of an array element in a Type definition is not
affected by the Option Base setting.) upper must be at least as big as
lower.
Dim A(100 To 200) '101 values
Note: For ReDim the lower and upper may be any valid expression. Otherwise, lower and upper must be constant expressions.
dlgvar A dialog variable holds values for fields in the dialog. Dialog variables are declared using Dim dlgvar As user dialog.
expr An simple or complex expression that returns the appropriate result.
• Simple: var, cond, date, num, str, obj, field, method, function (result) or property (result).
• Complex: One or more simple expressions with parenthesises and Operators.
field Use .field to access individual fields in a dialog variable.
dlg.LastName$
dlg.ZipCode
initialvalue Initial value for a variable. Use { expr, ... } to create an array value.
instruction A single command.
Beep
Debug.Print
"Hello"
Today
= Date
Multiple instructions may be used instead of a single instruction by separating the single instructions with colons.
X =
1:Debug.Print X
If X = 1 Then
Debug.Print "X=";X:Stop
Beep ' must resume from
Stop to get to here
label An identifier that names a statement. Identifiers start with a letter. Following chars may be a letter, an underscore or a digit.
little-endian Multiple byte data values (not strings) are stored with the lowest order byte first. For example, the long integer &H01020304 is stored as this sequence of four bytes: &H04, &H03, &H02 and &H01. A Binary or Random file written using Put uses little-endian format so that it can be read using Get on any machine. (Big-endian machines, like the Power-PC, reverse the bytes as they are read by Get or written by Put.)
macro A macro is like an application. Execution starts at the macro's Sub Main.
method
An object provides methods and properties. Methods can be called as
subs (the return value is ignored), or used as functions (the return value is
used).
If the method name contains characters that are not legal in a
name, surround the method name with [].
App.[Title$]
module A file with public symbols that are accessible by other modules/macros via the '#Uses special comment.
• A module is loaded on demand.
• A code module is a code library.
• An object module or class module implements an object.
• A module may also access other modules with its own '#Uses special comments.
name An identifier that names a variable or a user defined procedure. Identifiers start with a letter. Following chars may be a letter, an underscore or a digit.
Count
DaysTill2000
Get_Data
num An expression that returns a numeric result. Use &O to express an octal number. Use &H to express a hex number. The interpretation &H and &O is affected by the '#Language setting. Specific types of numbers can be indicated by using one of the endings shown in the table below:
Ending Description
I or % The number is a Integer value. The interpretation of the type is controlled by the '#Language setting.
L or & The number is a Long value. The interpretation of the type is controlled by the '#Language setting.
H The number is a Huge_ value.
UI The number is a UInteger value. The interpretation of the type is controlled by the '#Language setting.
UL The number is a ULong value. The interpretation of the type is controlled by the '#Language setting.
UH The number is a UHuge_ value.
C The number is a Currency value.
D The number is a Decimal value.
F or ! The number is a Single value.
R or # The number is a Double value.
? The number is a PortInt value.
@ The number is a Currency value. The interpretation of the type is controlled by the '#Language setting.
numstr An expression that returns a numeric or string result.
numvar A variable that holds one numeric value.
objexpr A expression that returns a reference to an object or module.
CreateObject("WinWrap.CDemoApplication")
objtype A specific type defined by your application, another application or by an object module or class module.
objvar A variable that holds a objexpr which references an object. Object variables are declared using As Object in a Dim, Private or Public statement.
param
[ [Optional] [ | ByVal | ByRef ] | ParamArray ] param[type][(
)] [As type] [ = defaultvalue ]
The param receives
the value of the associated expression in the Declare, Sub,
Function or Property call. (See arglist.)
• An Optional param may be omitted from the call. It may also have a defaultvalue. The parameter receives the defaultvalue if a value is not specified by the call. If the defaultvalue is omitted, the parameter is a Variant and no value is specified in the call then IsMissing will return True.
• All parameters following an Optional parameter must also be Optional.
• ParamArray may be used on the final param. It must be an array of Variant type. It must not follow any Optional parameters. The ParamArray receives all the expressions at the end of the call as an array. If LBound(param) > UBound(param) then the ParamArray didn't receive any expressions.
• If the param is not ByVal and the expression is merely a variable then the param is a reference to that variable (ByRef). (Changing param changes the variable.) Otherwise, the parameter variable is local to the procedure, so changing its value does not affect the caller.
• Use param( ) to specify an array parameter. An array parameter must be referenced and can not be passed by value. The bounds of the parameter array are available via LBound( ) and UBound( ).
precedence When several operators are used in an expression, each operator is evaluated in a predetermined order. Operators are evaluated in this order:
• ^ (power)
• - (negate)
• * (multiply), / (divide)
• \ (integer divide)
• Mod (integer remainder)
• + (add), - (difference)
• << (shift left), >> (shift right)
• & (string concatenate)
• = (equal), <> (not equal), < (less than) > (greater than), <= (less than or equal to), >= (greater than or equal to), Like, (string similarity) New, (object creation) TypeOf, (object type) Is, (object equivalence) IsNot (object non-equivalence)
• Not (bitwise invert)
• And (bitwise and), AndAlso (short-circuit logical and)
• Or (bitwise or), OrElse (short-circuit logical or)
• Xor (bitwise exclusive-or)
• Eqv (bitwise equivalence)
• Imp (bitwise implication)
Operators shown on the same line are evaluated from left to right.
procedure A subroutine, function or property.
property
An object provides methods and properties. Properties may be used as
values (like a function call) or changed (using assignment syntax).
If
the property name contains characters that are not legal in a name,
surround the property name with [].
App.[Title$]
statement Zero or more instructions. A statement is at least one line long. Begin Dialog, Do, For, If (multiline), Select Case, While and With statements are always more than one line long. A single line statement continues on the next line if it ends a line with a space and an underscore ' _'.
S$ = "This long string is
easier to read, " + _
"if
it is broken across two lines."
Debug.Print S$
str An expression that returns a string result.
"Hello"
S$
S$ + "
Goodbye"
S$
& " Goodbye"
Mid$(S$,2)
A string constant may have a 'C' suffix
S$ = "x"C
The 'C' suffix indicates that the string is one character long.
strarray A variable that holds an array of string values.
streamnum An expression that returns a numeric result. Streams 1 through 255 are private to each macro. Streams 256 through 511 are shared by all macros.
strvar A variable that holds one string value.
FirstName$
type Variable and parameter types, as well as, function and property results may be specified using a type character as the last character in their name.
Type char As Type
% Integer, The interpretation of the type is controlled by the '#Language setting.
& Long, The interpretation of the type is controlled by the '#Language setting.
! Single
# Double
@ Currency, The interpretation of the type is controlled by the '#Language setting.
$ String
? PortInt
user delegate User defined delegates are defined with Delegate.
user dialog User defined dialogs are defined with Begin Dialog.
user enum User defined enums are defined with Enum.
user type User defined types are defined with Type.
usertypevar A user defined type variable holds values for elements of the user defined type. User defined types are defined using Type.
• Declare with Dim, Private, Public or Static.
• Declare as a parameter of Sub, Function or Property definition.
var A variable holds either a string, a numeric value or an array of values depending on its type.
vardeclaration
name[type][([dimension[, ...]])][As [New] type]
The name declares a variable.
variantvar A variant variable can hold any type of value (except String*n). or it can hold an array.