The table below lists each of the BASIC scripting instructions.
Instruction Name |
Description |
AppActivate |
Syntax: AppActivate Title$ -or- AppActivate TaskID Group: Miscellaneous Description: Parameter Title$ The name shown in the title bar of the window. TaskID This numeric value is the task identifier. Example: Sub Main |
Beep |
Syntax: Beep Group: Miscellaneous Description: Example: Sub Main |
Call |
Syntax: Call name[(arglist)] -or- name [arglist] Group: Flow Control Description: Example: Sub Show(Title$,Value) Sub Main |
CallByName |
Syntax: CallByName(Obj,ProcName,CallType,[expr[,]]) Group: Flow Control Description: Parameters: Obj—Call the method/property for this object reference. ProcName—This string value is the name of the method/property to be called. CallType—Type of method/property call. See table below. expr—These expressions are passed to the obj's method/property. CallType Value Effect: - vbMethod 1 Call or evaluate the method. - vbGet 2 Evaluate the property's value. - vbLet 4 Assign the property's value. - vbSet 8 Set the property's reference. Example: Sub Main |
ChDir |
Syntax: ChDir Dir$ Group: File Description: Parameter: Dir$ This string value is the path and name of the directory. Example: Sub Main |
ChDrive |
Syntax: ChDrive Drive$ Group: File Description: Parameter: Drive$ This string value is the drive letter. Example: Sub Main |
Close |
Syntax: Close [[#]StreamNum][,] Group: File Description: Parameter: StreamNum Streams 1 through 255 are private to each macro. Streams 256 through 511 are shared by all macros. If this is omitted then all open streams for the current macro/module are closed. Example: Sub Main |
DDEExecute |
Syntax: DDEExecute ChanNum, Command$[, Timeout] Group: DDE Description: Parameters: ChanNum—This is the channel number returned by the DDEInitiate function. Up to 10 channels may be used at one time. Command$—Send this command value to the server application. The interpretation of this value is defined by the server application. Timeout—The command will generate an error if the number of seconds specified by the timeout is exceeded before the command has completed. The default is five seconds. Example: Sub Main |
DDEPoke |
Syntax: DDEPoke ChanNum, Item$, Data$[, Timeout] Group: DDE Description: Parameters: ChanNum—This is the channel number returned by the DDEInitiate function. Up to 10 channels may be used at one time. Item$—This is the server application's item. The interpretation of this value is defined by the server application. Data$—Send this data value to the server application. The interpretation of this value is defined by the server application. Timeout—The command will generate an error if the number of seconds specified by the timeout is exceeded before the command has completed. The default is five seconds. Example: Sub Main |
DDETerminate |
Syntax: DDETerminate ChanNum Group: DDE Description: Parameter: ChanNum—This is the channel number returned by the DDEInitiate function. Up to 10 channels may be used at one time. Example: Sub Main |
DDETerminateAll |
Syntax: DDETerminateAll Group: DDE Description: Example: Sub Main |
DeleteSetting |
Syntax: DeleteSetting AppName$, Section$[, Key$] Group: Settings Description: Parameters: AppName$—This string value is the name of the project which has this Section and Key. Section$—This string value is the name of the section of the project settings. Key$—This string value is the name of the key in the section of the project settings. If this is omitted then delete the entire section. Example: Sub Main |
DlgEnd |
Syntax: DlgEnd ReturnCode Group: Dialog Function Description: Parameter: ReturnCode—Return this numeric value. Example: Sub Main Dim dlg As UserDialog Function DialogFunc%(DlgItem$, Action%, SuppValue%) |
DlgSetPicture |
Syntax: DlgSetPicture DlgItem|$, FileName, Type Group: Dialog Function Description: Parameters: DlgItem|$—If this is a numeric value then it is the dialog item number. The first item is 0, second is 1, etc. If this is a string value then it is the dialog item's field name. FileName—Set the file name of DlgItem|$ to this string value. Type—This numeric value indicates the type of bitmap used: 0—FileName is the name of the bitmap file. If the file does not exist then "(missing picture)" is displayed. 3—The clipboard's bitmap is displayed. Not supported. +16—Instead of displaying "(missing picture)" a run-time error occurs. Example: Sub Main |
DoEvents |
Syntax: DoEvents Group: Miscellaneous Description: Example: Sub Main |
End |
Syntax: End Group: Flow Control Description: Example: Sub DoSub Sub Main |
Erase |
Syntax: Erase arrayvar[,...] -or- Erase usertypevar.elem[,...] Group: Assignment Description: Declare with Dim, Private, Public or Static. Declare as a parameter of Sub, Function or Property definition. Example: Sub Main Dim X%(2) X%(1) = 1 Erase X% Debug.Print X%(1) ' 0 End Sub |
Exit |
Syntax: Exit {All|Do|For|Function|Property|Sub|While} Group: Flow Control Description: All—Exit all macros. Do—Exit the Do loop. For—Exit the For of For Each loop. Function—Exit the Function block. Note: This instruction clears the Err and sets Error$ to null. Property—Exit the Property block. Note: This instruction clears the Err and sets Error$ to null. Sub—Exit the Sub block. Note: This instruction clears the Err and sets Error$ to null. While—Exit the While loop. Example: Sub Main Sub DoSub(L$) |
FileCopy |
Syntax: FileCopy FromName$, ToName$ Group: File Description: Parameters: FromName$—This string value is the path and name of the source file. A path relative to the current directory can be used. ToName$—This string value is the path and name of the destination file. A path relative to the current directory can be used. Example: Sub Main |
Get |
Syntax: Get StreamNum, [RecordNum], var Group: File Description: Parameters: StreamNum—Streams 1 through 255 are private to each macro. Streams 256 through 511 are shared by all macros. RecordNrum—For Random mode files this is the record number. The first record is 1. Otherwise, it is the byte position. The first byte is 1. If this is omitted then the current position (or record number) is used. var—This variable value is read from the file. For a fixed length variable (like Long) the number of bytes required to restore the variable are read. For a Variant variable two bytes are read which describe its type and then the variable value is read accordingly. For a usertype variable each field is read in sequence. For an array variable each element is read in sequence. For a dynamic array variable the number of dimensions and range of each dimension is read prior to reading the array values. All binary data values are read from the file in little-endian format. Example: Sub Main |
Goto |
Syntax: GoTo label Group: Flow Control Description: Example: Sub Main |
Input |
Syntax: Input [#]StreamNum, var[,...] Group: File Description: Example: Sub Main |
Kill |
Syntax: Kill Name$ Group: File Description: Parameter: Name$—This string value is the path and name of the file. A path relative to the current directory can be used. Example: Sub Main |
Let |
Syntax: [Let] var = expr Group: Assignment Description: Example: Sub Main |
Line Input |
Syntax: Line Input [#]StreamNum, S$ Group: File Description: Example: Sub Main |
Lock |
Syntax: Lock StreamNum -or- Lock StreamNum, RecordNum -or- Lock StreamNum, [start] To end Group: File Description: Parameter StreamNum—Streams 1 through 255 are private to each macro. Streams 256 through 511 are shared by all macros. RecordNum—For Random mode files this is the record number. The first record is 1. Otherwise, it is the byte position. The first byte is 1. start—First record (or byte) in the range. end—Last record (or byte) in the range. Example: Sub Main |
LSet |
Syntax: LSet strvar = str -or- LSet usertypevar1 = usertypevar2 Group: Assignment Description: Example: Sub Main |
MacroRun |
Syntax: MacroRun MacroName$[, Command$] Group: Flow Control Description: Parameters: MacroName$—Run the macro named by this string value. Command$—Pass this string value as the macro's Command$ value. Example: Sub Main |
MacroRunThis |
Syntax: MacroRunThis MacroCode$ Group: Flow Control Description: Parameter MacroName$ Run the macro named by this string value. Example: Sub Main |
MkDir |
Syntax: MkDir Name$ Group: File Description: Parameter: Name$—This string value is the path and name of the directory. A path relative to the current directory can be used. Example: Sub Main |
Name |
Syntax: Name OldName$ As NewName$ Group: File Description: Parameters: OldName$—This string value is the path and name of the file. A path relative to the current directory can be used. NewName$—This is the new file name (and path). A path relative to the current directory can be used. Example: Sub Main |
On Error |
Syntax: On Error GoTo 0 -or- On Error GoTo label -or- On Error Resume Next Group: Error Handling Description: Example: Sub Main X: Debug.Print "Err=";Err Err.Clear |
Open |
Syntax: Open Name$ For mode [Access access] [lock] As [#]StreamNum [Len = RecordLen] Group: File Description: Parameters: Name$—This string value is the path and name of the file. A path relative to the current directory can be used. mode May be Input, Output, Append, Binary or Random. access—May be Read, Write or Read Write. lock—May be Shared, Lock Read, Lock Write or Lock Read Write. StreamNum—Streams 1 through 255 are private to each macro. Streams 256 through 511 are shared by all macros. RecordLen—This numeric value is the record length for Random mode files. Other file modes ignore this value. Example: Sub Main |
|
Syntax: Print #StreamNum, [expr[;...][;]] Group: File Description: Example: Sub Main |
Put |
Syntax: Put StreamNum, [RecordNum], var Group: File Description: Parameters: StreamNum—Streams 1 through 255 are private to each macro. Streams 256 through 511 are shared by all macros. RecordNum—For Random mode files this is the record number. The first record is 1. Otherwise, it is the byte position. The first byte is 1. If this is omitted then the current position (or record number) is used. va—This variable value is written to the file. For a fixed length variable (like Long) the number of bytes required to store the variable are written. For a Variant variable two bytes which describe its type are written and then the variable value is written accordingly. For a usertype variable each field is written in sequence. For an array variable each element is written in sequence. For a dynamic array variable the number of dimensions and range of each dimension is written prior to writing the array values. All binary data values are written to the file in little-endian format. Note: When a writing string (or a dynamic array) to a Binary mode file the string length (or array dimension) information is not written. Only the string data or array elements are written. Example: Sub Main |
Randomize |
Syntax: Randomize [Seed] Group: Math Description: Parameter: Seed—This numeric value sets the initial seed for the random number generator. If this value is omitted then the current time is used as the seed. Example: Sub Main |
ReDim |
Syntax: ReDim [Preserve] name[type][([dim[,...]])] [As type][,...] -or- ReDim [Preserve] usertypevar.elem[type][([dim[,...]])] [As type][,...] Group: Declaration Description: Example: Sub Main |
Rem |
Syntax: Rem... -or- '... Group: Miscellaneous Description: Example: Sub Main |
Reset |
Syntax: Reset Group: File Description: Example: Sub Main |
Resume |
Syntax: Resume label -or- Resume Next Group: Error Handling Description: Example: Sub Main X: Debug.Print "Err=";Err |
RmDir |
Syntax: RmDir Name$ Group: File Description: Parameter Name$—This string value is the path and name of the directory. A path relative to the current directory can be used. Example: Sub Main |
RSet |
Syntax: RSet strvar = str Group: Assignment Description: Example: Sub Main |
SaveSetting |
Syntax: SaveSetting AppName$, Section$, Key$, Setting Group: Settings Description: Parameters: AppName$—This string value is the name of the project which has this Section and Key. Section$—This string value is the name of the section of the project settings. Key$—This string value is the name of the key in the section of the project settings. Setting—Set the key to this value. (The value is stored as a string.) Example: Sub Main |
Seek |
Syntax: Seek [#]StreamNum, Count Group: File Description: Parameters: StreamNum—Streams 1 through 255 are private to each macro. Streams 256 through 511 are shared by all macros. Count—For Random mode files this is the record number. The first record is 1. Otherwise, it is the byte position. The first byte is 1. Example: Sub Main |
SendKeys |
Syntax: SendKeys Keys$[, Wait] Group: Miscellaneous Description: Parameters: Keys$—Send the keys in this string value to Windows. (Refer to table below.) Wait—If this is not zero then the keys are sent before executing the next instruction. If this is omitted or zero then the keys are sent during the following instructions. Key - Description + Shift modifier key: the following key is a shifted key ^ Ctrl modifier key: the following key is a control key % Alt modifier key: the following key is an alt key (keys) Modifiers apply to all keys ~ Send Enter key k Send k Key (k is any single char) K Send Shift k Key (K is any capital letter) {special n} special key (n is an optional repeat count) {mouse x,y} mouse key (x,y is an optional screen position) {k} Send k Key (any single char) {K} Send Shift k Key (any single char) {Cancel} Send Break Key {Esc} Send Escape Key {Escape} Send Escape Key {Enter} Send Enter Key {Menu} Send Menu Key (Alt) {Help} Send Help Key (?) {Prtsc} Send Print Screen Key {Print} Send {Execute} Send ? {Tab} Send {Pause} Send Pause Key {Tab} Send Tab Key {BS} Send Back Space Key {BkSp} Send Back Space Key {BackSpace} Send Back Space Key {Del} Send Delete Key {Delete} Send Delete Key {Ins} Send Insert Key {Insert} Send Insert Key {Left} Send Left Arrow Key {Right} Send Right Arrow Key {Up} Send Up Arrow Key {Down} Send Down Arrow Key {PgUp} Send Page Up Key {PgDn} Send Page Down Key {Home} Send Home Key {End} Send End Key {Select} Send ? {Clear} Send Num Pad 5 Key {Pad0..9} Send Num Pad 0-9 Keys {Pad*} Send Num Pad * Key {Pad+} Send Pad + Key {PadEnter} Send Num Pad Enter {Pad.} Send Num Pad. Key {Pad-} Send Num Pad - Key {Pad/} Send Num Pad / Key {F1..24} Send F1 to F24 Keys Mouse: {Move x,y} - move the mouse to (x,y) {ClickLeft x,y} - move the mouse to (x,y) and click the left button. (This is the same as {DownLeft x,y}{UpLeft}.) {DoubleClickLeft x,y} - move the mouse to (x,y) and click the left button. (This is NOT the same as {ClickLeft x,y}{ClickLeft}.) {DownLeft x,y} - move the mouse to (x,y) and push the left button down. {UpLeft x,y} - move the mouse to (x,y) and release the left button. {...Middle x,y} - similarly named keys for the middle mouse button. {...Right x,y} - similarly named keys for the right mouse button. The x,y values are screen pixel locations, where (0,0) is in the upper-left corner. In all cases the x,y is optional. If omitted, the previous mouse position is used. Example: Sub Main |
Set |
Syntax: Set objvar = objexpr -or- Set objvar = New objtype Group: Assignment Description: Example: Sub Main |
SetAttr |
Syntax: SetAttr Name$, Attrib Group: File Description: Parameters: Name$—This string value is the path and name of the file. A path relative to the current directory can be used. Attrib—Set the file's attributes to this numeric value. Example: Sub Main |
Stop |
Syntax: Stop Group: Flow Control Description: Example: Sub Main End Sub |
Unlock |
Syntax: Unlock StreamNum -or- Unlock StreamNum, RecordNum -or- Unlock StreamNum, [start] To end Group: File Description: Parameters: StreamNum—Streams 1 through 255 are private to each macro. Streams 256 through 511 are shared by all macros. RecordNum—For Random mode files this is the record number. The first record is 1. Otherwise, it is the byte position. The first byte is 1. start—First record (or byte) in the range. end—Last record (or byte) in the range. Example: Sub Main |
Wait |
Syntax: Wait Delay Group: Miscellaneous Description: Example: Sub Main |
Write |
Syntax: Write #StreamNum, expr[,...] Group: File Description: Example: Sub Main |