Definition Name |
Description |
||||||||||
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. |
||||||||||
Array Variable |
A variable that holds an array of values. A Variant variable can hold an array. Dynamic arrays can be ReDimensioned. |
||||||||||
As [New] Type |
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, Double, Integer, Long, Object, PortInt, Single, String, String*n, UserDialog, Variant, objtype, userenum, usertype. |
||||||||||
Attribute Definition/Statement |
Syntax: Attribute attributename = value Attribute varname.attributename = value Attribute procname.attributename = value Group: Declaration Description: All attribute definitions and statements are ignored except for: Form 1: Module level attribute
Form 2: Macro/Module level variable attribute
Form 3: User defined procedure attribute
HelpFile: Each macro/module can define the HelpFile for the object browser: '#HelpFile "helpfile" where "helpfile" is a full path to the help file associated with the help text and help context. |
||||||||||
Attribute |
A file attribute is zero or more of the following values added together. Attribute Value Description
|
||||||||||
Begin Dialog |
Syntax: Begin Dialog UserDialog [X, Y,] DX, DY[, Title$] [,.dialogfunc] User Dialog Item [User Dialog Item] End Dialog Group: User Dialog Description: Define a UserDialog type to be used later in a Dim As UserDialog statement. Parameters:
User Dialog Item: One of: CancelButton, CheckBox, ComboBox, DropListBox, GroupBox, ListBox, OKButton, OptionButton, OptionGroup, PushButton, Text, TextBox. Example: Sub Main Begin Dialog UserDialog 200,120 Text 10,10,180,15,"Please push the OK button" OKButton 80,90,40,20 End Dialog Dim dlg As UserDialog Dialog dlg ' show dialog (wait for ok) End Sub |
||||||||||
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.) |
||||||||||
CancelButton Dialog Item |
Syntax: CancelButton X, Y, DX, DY[,.Field] Group: User Dialog Description: Define a cancel button item. Pressing Cancel from a Dialog instruction causes a run-time error. (Dialog( ) function call returns 0.) Parameters:
Example: Sub Main Begin Dialog UserDialog 200,120 Text 10,10,180,30,"Please push Cancel" OKButton 40,90,40,20 CancelButton 110,90,60,20 End Dialog Dim dlg As UserDialog Dialog dlg ' show dialog (wait for cancel) Debug.Print "Cancel was not pressed" End Sub |
||||||||||
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. |
||||||||||
CheckBox Dialog Item |
Syntax: CheckBox X, Y, DX, DY, Title$,.Field[, Options] Group: User Dialog Description: Define a checkbox item. Parameters:
See Also: Begin Dialog, Dim As UserDialog. Example: Sub Main Begin Dialog UserDialog 200,120 Text 10,10,180,15,"Please push the OK button" CheckBox 10,25,180,15,"&Check box",.Check OKButton 80,90,40,20 End Dialog Dim dlg As UserDialog dlg.Check = 1 Dialog dlg ' show dialog (wait for ok) Debug.Print dlg.Check End Sub |
||||||||||
ComboBox Dialog Item |
Syntax: ComboBox X, Y, DX, DY, StrArray$( ),.Field$[, Options] Group: User Dialog Description: Define a combo box item. Combo boxes combine the functionality of an edit box and a list box. Parameters:
Example: Sub Main Dim combos$(3) combos$(0) = "Combo 0" combos$(1) = "Combo 1" combos$(2) = "Combo 2" combos$(3) = "Combo 3" Begin Dialog UserDialog 200,120 Text 10,10,180,15,"Please push the OK button" ComboBox 10,25,180,60,combos$(),.combo$ OKButton 80,90,40,20 End Dialog Dim dlg As UserDialog dlg.combo$ = "none" Dialog dlg ' show dialog (wait for ok) Debug.Print dlg.combo$ End Sub |
||||||||||
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" Const Definition Syntax: [ | Private | Public ] _ Const name[type] [As Type] = expr[,] Group: Declaration Description: Define name as the value of expr. The expr may be refer other constants or built-in functions. If the type of the constants is not specified, the type of expr is used. Constants defined outside a Sub, Function or Property block are available in the entire macro/module. Private is assumed if neither Private or Public is specified. Note: Const statement in a Sub, Function or Property block may not use Private or Public. Example: Sub Main Const Pi = 4*Atn(1), e = Exp(1) Debug.Print Pi ' 3.14159265358979 Debug.Print e ' 2.71828182845905 End Sub |
||||||||||
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 |
||||||||||
Declare |
Syntax: [ | Private | Public ] _ Declare Sub name Lib "dll name" _ [Alias "module name"] [([param[,...]])] -or- [ | Private | Public ] _ Declare Function name[type] Lib "dll name" _ [Alias "module name"] [([param[,...]])] [As type[()]] Group: Declaration Description: Interface to a DLL defined subroutine or function. The values of the calling arglist are assigned to the params. Declare defaults to Public if neither Private nor Public is specified. WARNING! Be very careful when declaring DLL subroutines or functions. If you make a mistake and declare the parameters or result incorrectly then Windows might halt. Save any open documents before testing new DLL declarations. Err.LastDLLError returns the error code for that last DLL call (Windows 32 bit versions only). Parameters:
Example: Declare Function GetActiveWindow& Lib "user32" () Declare Function GetWindowTextLengthA& Lib "user32" (ByVal hwnd&) Declare Sub GetWindowTextA Lib "user32" (ByVal hwnd&, ByVal lpsz$, ByVal cbMax&) Function ActiveWindowTitle$() ActiveWindow = GetActiveWindow() TitleLen = GetWindowTextLengthA(ActiveWindow) Title$ = Space$(TitleLen) GetWindowTextA ActiveWindow,Title$,TitleLen+1 ActiveWindowTitle$ = Title$ End Function Sub Main Debug.Print ActiveWindowTitle$() End Sub |
||||||||||
Def |
Syntax: Def{Bool|Cur|Date|Dbl|Int|Lng|Obj|Sng|Str|Var} letterrange[,...] Group: Declaration Description: Define untyped variables as:
Parameters: letterrange letter, or letter-letter: A letter is one of A to Z. When letter-letter is used, the first letter must be alphabetically before the second letter. Variable names that begin with a letter in this range default to declared type. If a variable name begins with a letter not specific in any letterrange, then the variable is a Variant. The letterranges are not allowed to overlap. Example: DefInt A,C-W,Y' integer DefBool B ' boolean DefStr X ' string ' all others are variant Sub Main B = 1 ' B is an boolean Debug.Print B ' True X = "A" ' X is a string Debug.Print X '"A" Z = 1 ' Z is a variant (anything) Debug.Print Z ' 1 Z = "Z" Debug.Print Z '"Z" End Sub |
||||||||||
Dialogfunc |
A dialog function executes while a UserDialog is visible. |
||||||||||
Dim |
Syntax: Dim [WithEvents] name[type][([dim[,...]])][As [New] type][,...] Group: Declaration Description: Dimension var array(s) using the dims to establish the minimum and maximum index value for each dimension. If the dims are omitted then a scalar (single value) variable is defined. A dynamic array is declared using ( ) without any dims. It must be ReDimensioned before it can be used. Example: Sub DoIt(Size) Dim C0,C1(),C2(2,3) ReDim C1(Size) ' dynamic array C0 = 1 C1(0) = 2 C2(0,0) = 3 Debug.Print C0;C1(0);C2(0,0) ' 1 2 3 End Sub Sub Main DoIt 1 End Sub |
||||||||||
Dim |
[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 UserDialog. |
||||||||||
DropListBox Dialog Item |
Syntax: DropListBox X, Y, DX, DY, StrArray$( ),.Field[, Options] Group: User Dialog Description: Define a drop-down listbox item. Parameters:
See Also: Begin Dialog, Dim As UserDialog. Example: Sub Main Dim lists$(3) lists$(0) = "List 0" lists$(1) = "List 1" lists$(2) = "List 2" lists$(3) = "List 3" Begin Dialog UserDialog 200,120 Text 10,10,180,15,"Please push the OK button" DropListBox 10,25,180,60,lists$(),.list1 DropListBox 10,50,180,60,lists$(),.list2,1 OKButton 80,90,40,20 Dim dlg As UserDialog dlg.list1 = 2 ' list1 is a numeric field dlg.list2 = "xxx" ' list2 is a string field Dialog dlg ' show dialog (wait for ok) End Sub |
||||||||||
Enum |
Syntax: [ | Private | Public ] Enum name [...] End Enum Group: Declaration Description: Define a new userenum. Each elem defines an element of the enum. If value is given then that is the element's value. The value can be any constant integer expression. If value is omitted then the element's value is one more than the previous element's value. If there is no previous element then zero is used. Enum defaults to Public if neither Private or Public is specified. Example: Enum Days Monday Tuesday Wednesday Thursday Friday Saturday Sunday End Enum Sub Main Dim D As Days For D = Monday To Friday Next D End Sub |
||||||||||
Expr |
An expression that returns the appropriate result. |
||||||||||
Field |
Use.field to access individual fields in a dialog variable. dlg.LastName$ dlg.ZipCode |
||||||||||
Function |
Syntax: [ | Private | Public | Friend ] [ Default ] Function name[type][([param[,...]])] [As type[()]] End Function Group: Declaration Description: User defined function. The function defines a set of statements to be executed when it is called. The values of the calling arglist are assigned to the params. Assigning to name[type] sets the value of the function result. Function defaults to Public if Private, Public or Friend are not is specified. See Also: Declare, Property, Sub. Example: Function Power(X,Y) P = 1 For I = 1 To Y P = P*X Next I Power = P End Function Sub Main End Sub |
||||||||||
GroupBox Dialog Item |
Syntax: GroupBox X, Y, DX, DY, Title$[,.Field] Group: User Dialog Description: Define a groupbox item. Parameters:
See Also: Begin Dialog, Dim As UserDialog. Example: Sub Main Begin Dialog UserDialog 200,120 Text 10,10,180,15,"Please push the OK button" GroupBox 10,25,180,60,"Group box" OKButton 80,90,40,20 Dim dlg As UserDialog Dialog dlg ' show dialog (wait for ok) |
||||||||||
Instruction |
A single command. Debug.Print "Hello" Today = Date Multiple instructions may be used instead of a single instruction by separating the single instructions with colons. 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. |
||||||||||
ListBox Dialog Item |
Syntax: ListBox X, Y, DX, DY, StrArray$( ),.Field[, Options] Group: User Dialog Description: Define a lis tbox item. Parameters:
See Also: Begin Dialog, Dim As UserDialog. Example: Sub Main Dim lists$(3) lists$(0) = "List 0" lists$(1) = "List 1" lists$(2) = "List 2" lists$(3) = "List 3" Begin Dialog UserDialog 200,120 Text 10,10,180,15,"Please push the OK button" ListBox 10,25,180,60,lists$(),.list OKButton 80,90,40,20 Dim dlg As UserDialog dlg.list = 2 Dialog dlg ' show dialog (wait for ok) End Sub |
||||||||||
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.) |
||||||||||
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$] |
||||||||||
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. |
||||||||||
Numvar |
A variable that holds one numeric value. The name of a numeric variable may be followed by the appropriate type char. |
||||||||||
Objexpr |
A expression that returns a reference to an object or module. CreateObject("WinWrap.CDemoApplication") |
||||||||||
Objtype |
A specific ActiveX Automation type defined by your application, another application or by an object module or class module. See Also: CreateObject( ), GetObject( ). |
||||||||||
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. |
||||||||||
OKButton Dialog Item |
Syntax: OKButton X, Y, DX, DY[,.Field] Group: User Dialog Description: Define an OK button item. Pressing the OK button updates the dlgvar field values and closes the dialog. (Dialog( ) function call returns -1.) Parameters:
See Also: Begin Dialog, Dim As UserDialog. Example: Sub Main Begin Dialog UserDialog 200,120 Text 10,10,180,30,"Please push the OK button" OKButton 80,90,40,20 Dim dlg As UserDialog Dialog dlg ' show dialog (wait for ok) End Sub |
||||||||||
Option |
Syntax: Option Base [0|1] -or- Option Compare [Binary | Text] -or- Option Explicit -or- Option Private Module Group: Declaration Description: Form 1: Set the default base index for array declarations. Affects Dim, Static, Private, Public and ReDim. Does not affect Array, ParamArray or arrays declare in a Type. Option Base 0 is the default. Form 2: Set the default comparison mode for string. • Option Compare Binary - compare string text using binary data (default) • Option Compare Text - compare string text using the collation rules String comparison using <, <=, =, >, >=, <>, Like and StrComp are affected by this mode's setting. Form 3: Require all variables to be declared prior to use. Variables are declared using Dim, Private, Public, Static or as a parameter of Sub, Function or Property blocks. Form 4: Public symbols defined by the module are only accessible from the same project. Example: Option Base 1 Option Explicit Sub Main Dim A Dim C(2) ' same as Dim C(1 To 2) Dim D(0 To 2) A = 1 B = 2 ' B has not been declared End Sub |
||||||||||
OptionButton Dialog Item |
Syntax: OptionButton X, Y, DX, DY, Title$[,.Field] Group: User Dialog Description: Define an option button item. Parameters:
See Also: Begin Dialog, Dim As UserDialog, OptionGroup. Example: Sub Main Begin Dialog UserDialog 200,120 Text 10,10,180,15,"Please push the OK button" OptionGroup.options OptionButton 10,30,180,15,"Option &0" OptionButton 10,45,180,15,"Option &1" OptionButton 10,60,180,15,"Option &2" OKButton 80,90,40,20 Dim dlg As UserDialog dlg.options = 2 Dialog dlg ' show dialog (wait for ok) |
||||||||||
OptionGroup Dialog Item |
Syntax: OptionGroup.Field OptionButton X, Y, DX, DY, Title$[,.Field] OptionButton X, Y, DX, DY, Title$[,.Field] Group: User Dialog Description: Define a optiongroup and option button items. Parameters:
See Also: Begin Dialog, Dim As UserDialog, OptionButton. Example: Sub Main Begin Dialog UserDialog 200,120 Text 10,10,180,15,"Please push the OK button" OptionGroup.options OptionButton 10,30,180,15,"Option &0" OptionButton 10,45,180,15,"Option &1" OptionButton 10,60,180,15,"Option &2" OKButton 80,90,40,20 Dim dlg As UserDialog dlg.options = 2 Dialog dlg ' show dialog (wait for ok) End Sub |
||||||||||
Param |
[ [Optional] [ | ByVal | ByRef ] | ParamArray ] param[type][( )] [As type] [ = default value ] 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 default value. The parameter receives the default value if a value is not specified by the call. If the default value 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( ). |
||||||||||
Picture Dialog Item |
Syntax: Picture X, Y, DX, DY, FileName$, Type[,.Field] Group: User Dialog Description: Define a picture item. The bitmap is automatically sized to fit the item's entire area. Parameters:
See Also: Begin Dialog, Dim As UserDialog. Example: Sub Main Begin Dialog UserDialog 200,120 Picture 10,10,180,75,"SAMPLE.BMP",0 OKButton 80,90,40,20 Dim dlg As UserDialog Dialog dlg ' show dialog (wait for ok) End Sub |
||||||||||
Order of Precedence |
When several operators are used in an expression, each operator is evaluated in a predetermined order. Operators are evaluated in this order:
Operators shown on the same line are evaluated from left to right. |
||||||||||
Private
|
Syntax: Private [WithEvents] name[type][([dim[,...]])] [As [New] type][,...] Group: Declaration Description: Create arrays (or simple variables) which are available to the entire macro/module, but not other macros/modules. Dimension var array(s) using the dims to establish the minimum and maximum index value for each dimension. If the dims are omitted then a scalar (single value) variable is defined. A dynamic array is declared using ( ) without any dims. It must be ReDimensioned before it can be used. The Private statement must be placed outside of Sub, Function or Property blocks. See Also: Dim, Option Base, Public, ReDim, Static, WithEvents. Example: Private A0,A1(1),A2(1,1) Sub Init A0 = 1 A1(0) = 2 A2(0,0) = 3 End Sub Sub Main Init Debug.Print A0;A1(0);A2(0,0) ' 1 2 3 End Sub |
||||||||||
Procedure |
|||||||||||
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$] Syntax: [ | Private | Public | Friend ] [ Default ] Property Get name[type][([param[,...]])] [As type[()]] End Property -or- [ | Private | Public | Friend ] Property [Let|Set] name[([param[,...]])] End Property Group: Declaration Description: User defined property. The property defines a set of statements to be executed when its value is used or changed. A property acts like a variable, except that getting its value calls Property Get and changing its value calls Property Let (or Property Set). Property Get and Property Let with the same name define a property that holds a value. Property Get and Property Set with the same name define a property that holds an object reference. The values of the calling arglist are assigned to the params. (For Property Let and Property Set the last parameter is the value on the right hand side of the assignment operator.) Property defaults to Public if Private, Public or Friend are not is specified. Example: Dim X_Value Property Get X() X = X_Value End Property Property Let X(NewValue) If Not IsNull(NewValue) Then X_Value = NewValue End Property Sub Main X = "Hello" X = Null End Sub |
||||||||||
Public |
Syntax: Public [WithEvents] name[type][([dim[,...]])] [As [New] type][,...] Group: Declaration Description: Create arrays (or simple variables) which are available to the entire macro/module and other macros/modules. Dimension var array(s) using the dims to establish the minimum and maximum index value for each dimension. If the dims are omitted then a scalar (single value) variable is defined. A dynamic array is declared using ( ) without any dims. It must be ReDimensioned before it can be used. The Public statement must be placed outside of Sub, Function or Property blocks. See Also: Dim, Option Base, Private, ReDim, Static, WithEvents. Example: Public A0,A1(1),A2(1,1) Sub Init A0 = 1 A1(0) = 2 A2(0,0) = 3 End Sub Sub Main Init Debug.Print A0;A1(0);A2(0,0) ' 1 2 3 End Sub |
||||||||||
PushButton Dialog Item |
Syntax: PushButton X, Y, DX, DY, Title$[,.Field] Group: User Dialog Description: Define a push button item. Pressing the push button updates the dlgvar field values and closes the dialog. (Dialog( ) function call returns the push button's ordinal number in the dialog. The first push button returns 1.) Parameters:
See Also: Begin Dialog, Dim As UserDialog. Example: Sub Main Begin Dialog UserDialog 200,120 Text 10,10,180,30,"Please push the DoIt button" OKButton 40,90,40,20 PushButton 110,90,60,20,"&Do It" Dim dlg As UserDialog End Sub |
||||||||||
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$ |
||||||||||
Static |
Syntax: Static name[type][([dim[,...]])][As [New] type][,...] Group: Declaration Description: A static variable retains it value between procedure calls. Dimension var array(s) using the dims to establish the minimum and maximum index value for each dimension. If the dims are omitted then a scalar (single value) variable is defined. A dynamic array is declared using ( ) without any dims. It must be ReDimensioned before it can be used. See Also: Dim, Option Base, Private, Public, ReDim. Example: Sub A Static X X = "Hello" End Sub Sub Main A A ' prints "Hello" End Sub |
||||||||||
Str |
An expression that returns a string result. "Hello" S$ S$ + " Goodbye" S$ & " Goodbye" Mid$(S$,2) |
||||||||||
Strarray |
A variable that holds an array of string values. The name of a string variable may be followed by a $. |
||||||||||
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. The name of a string variable may be followed by a $. FirstName$ |
||||||||||
Sub
|
Syntax: [ | Private | Public | Friend ] Sub name[([param[,...]])] End Sub Group: Declaration Description: User defined subroutine. The subroutine defines a set of statements to be executed when it is called. The values of the calling arglist are assigned to the params. A subroutine does not return a result. Sub defaults to Public if Private, Public or Friend are not is specified. See Also: Declare, Function, Property. Example: Sub IdentityArray(A()) ' A() is an array of numbers For I = LBound(A) To UBound(A) A(I) = I Next I End Sub Sub CalcArray(A(),B,C) ' A() is an array of numbers For I = LBound(A) To UBound(A) A(I) = A(I)*B+C Next I End Sub Sub ShowArray(A()) ' A() is an array of numbers For I = LBound(A) To UBound(A) Next I End Sub Sub Main Dim X(1 To 4) IdentityArray X() ' X(1)=1, X(2)=2, X(3)=3, X(4)=4 CalcArray X(),2,3 ' X(1)=5, X(2)=7, X(3)=9, X(4)=11 ShowArray X() ' print X(1), X(2), X(3), X(4) End Sub |
||||||||||
Text Dialog Item |
Syntax: Text X, Y, DX, DY, Title$[,.Field][, Options] Group: User Dialog Description: Define a text item. Parameters:
See Also: Begin Dialog, Dim As UserDialog. Example: Sub Main Begin Dialog UserDialog 200,120 Text 10,10,180,15,"Please push the OK button" OKButton 80,90,40,20 Dim dlg As UserDialog Dialog dlg ' show dialog (wait for ok) End Sub |
||||||||||
TextBox Dialog Item |
Syntax: TextBox X, Y, DX, DY,.Field$[, Options] Group: User Dialog Description: Define a textbox item. Parameters:
See Also: Begin Dialog, Dim As UserDialog. Example: Sub Main Begin Dialog UserDialog 200,120 Text 10,10,180,15,"Please push the OK button" TextBox 10,25,180,20,.Text$ OKButton 80,90,40,20 Dim dlg As UserDialog dlg.Text$ = "none" Dialog dlg ' show dialog (wait for ok) End Sub |
||||||||||
Type |
Syntax: [ | Private | Public ] Type name elem [([dim[,...]])] As [New] type [...] End Type Group: Declaration Description: Define a new usertype. Each elem defines an element of the type for storing data. As [New] type defines the type of data that can be stored. A user defined type variable has a value for each elem. Use.elem to access individual element values. Type defaults to Public if neither Private or Public is specified. Example: Type Employee FirstName As String LastName As String Title As String Salary As Double End Type Sub Main Dim e As Employee e.FirstName = "John" e.LastName = "Doe" e.Title = "President" e.Salary = 100000 Debug.Print e.FirstName '"John" Debug.Print e.LastName '"Doe" Debug.Print e.Title '"President" Debug.Print e.Salary ' 100000 End Sub |
||||||||||
Type Symbols |
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 ? PortInt & Long ! Single # Double @ Currency $ String |
||||||||||
Userenum |
User defined enums are defined with Enum. |
||||||||||
Usertype |
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. |
||||||||||
Variantvar |
A variant variable can hold any type of value (except String*n or usertypevar). or it can hold an array. |
||||||||||
WithEvents |
Syntax: [Dim | Private | Public] WithEvents name As objtype[,...] Group: Declaration Description: Dimensioning a module level variable WithEvents allows the macro to implement event handling Subs. The variable's As type must be a type from a referenced type library (or language extension) which implements events. Example: Dim WithEvents X As Thing Sub Main Set X = New Thing X.DoIt ' DoIt method raises DoingIt event End Sub Private Sub X_DoingIt Debug.Print "X.DoingIt event" End Sub |