In computer programming, a function is a predefined formula which automatically generates various kinds of output. Its main purpose is to accept certain input from the user and return a value which is passed onto the main program to finish the execution. Functions can reduce code repetition and increase code readability.
Most programming languages such as VBScript come with a built-in range of functions that perform various actions or routines and return a specific value. AWE encompasses a VBA-compatible engine designed to extend the functionality available in AML (AWE Markup Language), the primary internal language that it uses. Not only does this allow multi-line BASIC scripts to be included in a task (with the use of the BASIC Script action), it allows all built-in, pre-defined Visual Basic functions to be used as an expression in text fields of any step of a task as well by surrounding the function with percent signs.
Some VBA-compatible functions require other parameters to properly complete a procedure or routine. The general format of a function is its name followed by any arguments contained between parentheses:
FunctionName (arguments)
For more details regarding the use of functions, see Using Functions.
A full library of pre-defined VBA functions can be found in the lower left pane of the Expression Builder under the Functions folder. Help regarding each function can be accessed by first expanding the Functions folder, then selecting the desired function from the lower right pane and pressing the F1 key or by right-clicking the function and selecting Help from the popup menu that appears.
Furthermore, AWE includes a large collection of additional functions that extend the functionality of the AWE Scripting Engine beyond the capabilities of what the basic VBA-compatible engine provides. These functions are collectively referred to as AWE Extended Functions.
Function Name |
Description |
Abs |
Syntax: Abs(Num) Group: Math Description: Return the absolute value. Parameters: Num—Return the absolute value of this numeric value. If this value is Null then Null is returned. Example: Sub Main |
Array |
Syntax: Array([expr[,]]) Group:r Conversion Description: Return a variant value array containing the exprs. Example: Sub Main |
Asc |
Syntax: Asc(S$) Group: String Description: Return the ASCII value. Parameters: S$—Return the ASCII value of the first char in this string value. Example: Sub Main |
Atn |
Syntax: Atn(Num) Group: Math Description: Return the arc tangent. This is the number of radians. There are 2*Pi radians in a full circle. Parameters: Num—Return the arc tangent of this numeric value. Example: Sub Main |
CallersLine |
Syntax: CallersLine[(Depth)] Group: Miscellaneous Description: Return the caller's line as a text string. Parameters: Depth—This integer value indicates how deep into the stack to get the caller's line. If Depth = -1 then return the current line. If Depth = 0 then return the calling subroutine's current line, etc.. If Depth is greater than or equal to the call stack depth then a null string is returned. If this value is omitted then the depth is 0. Example: Sub Main Sub A |
CBool |
Syntax: CBool(Num|$) Group: Conversion Description: Convert to a boolean value. Zero converts to False, while all other values convert to True. Parameters: Num|$—Convert a number or string value to a boolean value. Example: Sub Main |
CByte |
Syntax: CByte(Num|$) Group: Conversion Description: Convert to a byte value. Parameters: Num|$—Convert a number or string value to a byte value. Example: Sub Main |
CChar |
Syntax: CChar(expr) Group: Conversion Description: Convert a number or string value to an single character value. Parameters: expr—Convert a number or string value to an single character value. This is the first character of the string conversion. Example: Sub Main |
CCur |
Syntax: CCur(Num|$) Group: Conversion Description: Convert to a currency value. Parameters: Num|$—Convert a number or string value to a currency value. Example: Sub Main |
CDate |
Syntax: CDate(Num|$) -or- CVDate(Num|$) Group: Conversion Description: Convert to a date value. Parameters: Num|$—Convert a number or string value to a date value. Example: Sub Main |
CDbl |
Syntax: CDbl(Num|$) Group: Conversion Description: Convert to a double precision real. Parameters: Num|$—Convert a number or string value to a double precision real. Example: Sub Main |
CDec |
Syntax: CDec(Num|$) Group: Conversion Description: Convert to a decimal (96 bit scaled real). Parameters: Num|$—Convert a number or string value to a 96 bit scaled real. Example: Sub Main |
Choose |
Syntax: Choose(Index, expr[,]) Group: Flow Control Description: Return the value of the expr indicated by Index. Parameters: Index—The numeric value indicates which expr to return. If this value is less than one or greater than the number of exprs then Null is returned. expr—All expressions are evaluated. Example: Sub Main |
Chr |
Syntax: Chr[$](Num) Group: String Description: Return a one char string for the ASCII value. Parameters: Num—Return one char string for this ASCII numeric value. Example: Sub Main |
CInt |
Syntax: CInt(expr) Group: Conversion Description: Convert to a 16 bit integer. If the expr is too big (or too small) to fit then an overflow error occurs. Parameters: expr—Convert a number or string value to an integer. Example: Sub Main |
Clipboard Instruction/Function |
Syntax: Clipboard Text$ Or Clipboard[$][( )] Group: Miscellaneous Description: Form 1: Set the clipboard to Text$. This is like the Edit|Copy menu command. Form 2: Returns the text in the clipboard. Parameters: Text$—Put this string value into the clipboard. Example: Sub Main |
CLng |
Syntax: CLng(Num|$) Group: Conversion Description: Convert to a 32 bit long integer. If Num|$ is too big (or too small) to fit then an overflow error occurs. Parameters: Num|$—Convert a number or string value to a 32 bit integer. Example: Sub Main |
CObj |
Syntax: CObj(expr) Group: Conversion Description: Convert to an Object. The object contains the value. Parameters: expr—Convert to an object. If the parameter is already an object, return it. Example: Sub Main |
Command |
Syntax: Command[$] Group: Miscellaneous Description: Contains the value of the MacroRun parameters. Example: Sub Main |
Cos |
Syntax: Cos(Num) Group: Math Description: Return the cosine. Parameters: Num—Return the cosine of this numeric value. This is the number of radians. There are 2*Pi radians in a full circle. Example: Sub Main |
CreateObject |
Syntax: CreateObject(Class$) Group: Object Description: Create a new object of type Class$. Use Set to assign the returned object to an object variable. Parameters: Class$—This string value is the application's registered class name. If this application is not currently active it will be started. Example: Sub Main Set App = CreateObject("WinWrap.CppDemoApplication") Set App = Nothing |
CSng |
Syntax: CSng(expr) Group: Conversion Description: Convert to a single precision real. If expr is too big (or too small) to fit then an overflow error occurs. Parameters: expr—Convert a number or string value to a single precision real. Example: Sub Main |
CShort |
Syntax: CShort(Num|$) Group: Conversion Description: Convert to a 16 bit signed integer Short value. If expr is too big (or too small) to fit then an overflow error occurs. Parameters: expr—Convert a number or string value to a 16 bit signed integer. Example: Sub Main |
CType |
Syntax: CShort(expr ) Group: Conversion Description: Convert an expr to the specified objtype type. Conversion include inheritance, implementation and value conversion. If the expr can't be converted, a "type mismatch error" will occur. Parameters: expr—Convert the value of this expression. objtype—Convert to this type. Example: Sub Main Dim V As Object V = Err Debug.Print TypeName(CType(V, ErrObject)) ' ErrObject |
CStr |
Syntax: CStr(expr) Group: Conversion Description: Convert to a string. Parameters: expr—Convert a number or string value to a string value using the current locale (GetLocale). Example: Sub Main |
CUInt |
Syntax: CUInt(expr) Group: Conversion Description: Convert to an UInteger. If expr is too big (or too small) to fit then an overflow error occurs. Parameters: expr—Convert a number or string value to an UInteger. Example: Sub Main |
CULng |
Syntax: CULng(expr) Group: Conversion Description: Convert to a ULong. If expr is too big (or too small) to fit then an overflow error occurs. Parameters: expr—Convert a number or string value to a ULong. Example: Sub Main |
CurDir |
Syntax: CurDir[$]([Drive$]) Group: File Description: Return the current directory for Drive$. Parameters: Drive$—This string value is the drive letter. If this is omitted or null then return the current directory for the current drive. Example: Sub Main |
CVar |
Syntax: CVar(expr) Group: Conversion Description: Convert to a variant value. Parameters: expr—Convert a number or string value (or object reference) to a variant value. Example: Sub Main |
CVErr |
Syntax: CVErr(expr) Group: Conversion Description: Convert to a variant that contains an error code. An error code can't be used in expressions. Parameters: expr—Convert a number or string value to an error code. Example: Sub Main |
Date |
Syntax: Date[$] Group: Time/Date Description: Return today's date as a date value. Example: Sub Main |
DateAdd |
Syntax: DateAdd(interval, number, dateexpr) Group: Time/Date Description: Return a date value a number of intervals from another date. Parameters: interval—This string value indicates which kind of interval to add. number—Add this many intervals. Use a negative value to get an earlier date. dateexpr—Calculate the new date relative to this date value. If this value is Null then Null is returned. Interval—Description yyyy—Year q—Quarter m—Month y—Day of year d—Day w—Weekday ww—Week h—Hour n—Minute s—Second Example: Sub Main |
DateDiff |
Syntax: DateDiff(interval, dateexpr1, dateexpr2) Group: Time/Date Description: Return the number of intervals between two dates. Parameters: interval—This string value indicates which kind of interval to add. number—Add this many intervals. Use a negative value to get an earlier date. dateexpr—Calculate the new date relative to this date value. If this value is Null then Null is returned. Interval—Description yyyy—Year q—Quarter m—Month y—Day of year d—Day w—Weekday ww—Week h—Hour n—Minute s—Second Example: Sub Main |
DatePart |
Syntax: DatePart(interval, dateexpr) Group: Time/Date Description: Return the number from the date corresponding to the interval. Parameters: interval—This string value indicates which kind of interval to add. dateexpr—Calculate the new date relative to this date value. If this value is Null then Null is returned. Interval—Description (Return value range) yyyy—Year (100-9999) q—Quarter (1-4) m—Month (1-12) y—Day of year (1-366) d—Day (1-31) w—Weekday (1-7) ww—Week (1-53) h—Hour (0-23) n—Minute (0-59) s—Second (0-59) Example: Sub Main |
DateSerial |
Syntax: DateSerial(Year, Month, Day) Group: Time/Date Description: Return a date value. Parameters: Year—his numeric value is the year (0 to 9999). (0 to 99 are interpreted by the operating system.) Month—This numeric value is the month (1 to 12). Day—This numeric value is the day (1 to 31). Example: Sub Main |
DateValue |
Syntax: DateValue(Date$) Group: Time/Date Description: Return the day part of the date encoded as a string. Parameters: Date$—Convert this string value to the day part of date it represents. Example: Sub Main |
Day |
Syntax: Day(dateexpr) Group: Time/Date Description: Return the day of the month (1 to 31). Parameters: dateexpr—Return the day of the month for this date value. If this value is Null then Null is returned. Example: Sub Main |
DDEInitiate |
Syntax: DDEInitiate(App$, Topic$) Group: DDE Description: Initiate a DDE conversation with App$ using Topic$. If the conversation is successfully started then the return value is a channel number that can be used with other DDE instructions and functions. Parameters: App$—Locate this server application. Topic$—This is the server application's topic. The interpretation of this value is defined by the server application. Example: Sub Main |
DDERequest |
Syntax: DDERequest[$](ChanNum, Item$[, Timeout]) Group: DDE Description: Request information for Item$. If the request is not satisfied then the return value will be a null string. 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. 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 |
Decode64 |
Syntax: Decode64[$](Data) -or- Decode64B(Data) Group: Miscellaneous Description: Returns a string using the base 64 decoding algorithm. Decode64B returns a Byte array. Parameters: Data—Return this string's base 64 decoding. Example: Sub Main |
Decrypt64 |
Syntax: Decrypt64[$](Data [,Password]) -or- Decrypt64B(Data [,Password]) Group: Miscellaneous Description: Returns a string using the RC4 stream decryption algorithm. Decrypt64B returns a Byte array. Parameters: Data—Return this string's decryption. (The string is first decoded using base 64 decoding.) Password—Decrypt using this password. Example: Sub Main |
Dialog Instruction/Function |
Syntax: Dialog dialogvar[, default] -or- Dialog(dialogvar[, default]) Group: User Input Description: Display the dialog associated with dialogvar. The initial values of the dialog fields are provided by dialogvar. If any button is clicked, then the fields in the dialog are copied to the dialogvar. The Dialog( ) function returns a value indicating which button was clicked. (See the result table below.) Parameters: dlgvar—This variable that holds the values of the fields in a dialog. Use field to access individual fields in a dialog variable. default—This numeric value indicates which button is the default button. (Pressing the Enter key on a non-button pushes the default button.) Use -2 to indicate that there is no default button. Other possible values are shown the result table below. If this value is omitted then the first PushButton, OKButton or CancelButton is the default button. Result—Description -1—This variable that holds the values of the fields in a dialog. Use field to access individual fields in a dialog variable. 0—This numeric value indicates which button is the default button. (Pressing the Enter key on a non-button pushes the default button.) Use -2 to indicate that there is no default button. Other possible values are shown the result table below. If this value is omitted then the first PushButton, OKButton or CancelButton is the default button. >0—Nth push button was pressed. Example: Sub Main |
Dir |
Syntax: Dir[$]([Pattern$][, AttribMask]) Group: File Description: Scan a directory for the first file matching Pattern$. Parameters: Pattern$—This string value is the path and name of the file search pattern. If this is omitted then continue scanning with the previous pattern. Each macro has its own independent search. A path relative to the current directory can be used. AttribMask—This numeric value indicates which button is the default button. (Pressing the Enter key on a non-button pushes the default button.) Use -2 to indicate that there is no default button. Other possible values are shown the result table below. If this value is omitted then the first PushButton, OKButton or CancelButton is the default button. Example: Sub Main While F$ <> "" |
DirectCast |
Syntax: DirectCast(expr, objtype) Group: Conversion Description: Return expr's type is related to objtype type. If it is not, a "type mismatch error" will occur. Parameters: expr—Cast the value of this expression. objtype—Cast to this type. Example: Sub Main Dim V As Object V = Err |
DlgControlId |
Syntax: DlgControlId(DlgItem) Group: Dialog Function Description: Return the field's window id. 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. Example: Sub Main Dim dlg As UserDialog Function DialogFunc%(DlgItem$, Action%, SuppValue%) |
DlgCount |
Syntax: DlgCount() Group: Dialog Function Description: Return the number of dialog items in the dialog. Example: Sub Main Function DialogFunc%(DlgItem$, Action%, SuppValue%) |
DlgEnable Instruction/Function |
Syntax: DlgEnable DlgItem, Enable] -or- DlgEnable(DlgItem) Group: Dialog Function Description: · Instruction: Enable or disable DlgItem. · Function: Return True if DlgItem is enabled. This instruction/function must be called directly or indirectly from a dialogfunc. 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. Note: Use -1 to enable or disable all the dialog items at once. default—IF this numeric value is True then enable DlgItem|$. Otherwise, disable it. If this omitted then toggle it. Enable It this numeric value is True then enable DlgItem|$. Otherwise, disable it. If this omitted then toggle it. Example: Sub Main Dim dlg As UserDialog Function DialogFunc%(DlgItem$, Action%, SuppValue%) |
DlgFocus Instruction/Function |
Syntax: DlgFocus DlgItem or DlgFocus[$]() Group: Dialog Function Description: · Instruction: Move the focus to this DlgItem. · Function: Return the field name which has the focus as a string. This instruction/function must be called directly or indirectly from a dialogfunc. 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. Example: Sub Main Function DialogFunc%(DlgItem$, Action%, SuppValue%) |
DlgListBoxArray Instruction/Function |
Syntax: DlgListBoxArray DlgItem, StrArray$( ) -or- DlgListBoxArray(DlgItem[, StrArray$( )]) Group: Dialog Function Description: · Instruction: Set the list entries for DlgItem. · Function: Return the number entries in DlgItem's list. This instruction/function must be called directly or indirectly from a dialogfunc. The DlgItem|$ should refer to a ComborBox, DropListBox or ListBox. 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. StrArray$( )—Set the list entries of DlgItem|$. This one-dimensional array of strings establishes the list of choices. All the non-null elements of the array are used. Example: Dim lists$() Function DialogFunc%(DlgItem$, Action%, SuppValue%) |
DlgName |
Syntax: DlgName[$](DlgItem) Group: Dialog Function Description: Return the field name of the DlgItem number. Parameters: DlgItem—This numeric value is the dialog item number. The first item is 0, second is 1, etc. Example: Sub Main Text 10,10,180,15,"Please push the OK button" Function DialogFunc%(DlgItem$, Action%, SuppValue%) |
DlgNumber |
Syntax: DlgNumber(DlgItem$) Group: Dialog Function Description: Return the number of the DlgItem$. The first item is 0, second is 1, etc. Parameters: DlgItem$—This string value is the dialog item's field name. Example: Sub Main Function DialogFunc%(DlgItem$, Action%, SuppValue%) |
DlgText Instruction/Function |
Syntax: DlgText DlgItem, Text or DlgText[$](DlgItem|$) Group: Dialog Function Description: · Instruction: Set the text for DlgItem · Function: Return the text from DlgItem. This instruction/function must be called directly or indirectly from a dialogfunc. 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. Note: Use -1 to access the dialog's title. Text—Set the text of DlgItem to this string value Example: Sub Main Function DialogFunc%(DlgItem$, Action%, SuppValue%) |
DlgType |
Syntax: DlgType[$](DlgItem) Group: Dialog Function Description: Return a string value indicating the type of the DlgItem|$. One of: "CancelButton", "CheckBox", "ComboBox", "DropListBox", "GroupBox", "ListBox", "OKButton", "OptionButton", "OptionGroup", "PushButton", "Text", "TextBox". 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. Example: Sub Main Function DialogFunc%(DlgItem$, Action%, SuppValue%) |
DlgValue Instruction/Function |
Syntax: DlgValue DlgItem, Value -or- DlgValue(DlgItem) Group: Dialog Function Description: Instruction: Set the numeric value(S) DlgItem. 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. Text Set the text of DlgItem to this string value. Value—Set the text of DlgItem to this numeric value. (A MultiListBox user dialog item uses an array.) Example: Sub Main Function DialogFunc%(DlgItem$, Action%, SuppValue%) |
DlgVisible Instruction/Function |
Syntax: DlgVisible DlgItem[, Visible] or DlgVisible(DlgItem) Group: Dialog Function Description: Instruction: Show or hide DlgItem 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. Enable—If this numeric value is True then show DlgItem. Otherwise, hide it. If this omitted then toggle it. Example: Sub Main Function DialogFunc%(DlgItem$, Action%, SuppValue%) |
Encode64 |
Syntax: Encode64[$](Data) -or- Encode64B[$](Data) Group: Miscellaneous Description: Return a string using the base 64 encoding algorithm. Parameters: Data—Return this string's base 64 decoding. Example: Sub Main |
Encrypt64 |
Syntax: Encrypt64[$](Data[,Password]) Group: Miscellaneous Description: Return a string using the RC4 stream encryption algorithm. (The string is also encoded using base 64 encoding.) Parameters: Data—Return this string's encryption. Password—Encrypt using this password. Example: Sub Main |
Environ |
Syntax: Environ[$](Index) -or- Environ[$](Name) Group: Miscellaneous Description: Return an environment string. Parameters: Index—Return this environment string's value. If there is no environment string at this index a null string is returned. Indexes start at one. Name—Return this environment string's value. If the environment string can't be found a null string is returned. Example: Sub Main |
EOF |
Syntax: EOF(StreamNum) Group: File Description: Return True if StreamNum is at the end of the file. Parameters: StreamNum—Streams 1 through 255 are private to each macro. Streams 256 through 511 are shared by all macros. Example: Sub Main |
Error Instruction/Function |
Syntax: Error ErrorCode -or- Error[$]([ErrorCode]) Group: Error Handling Description: · Instruction: Signal error ErrorCode. This triggers error handling just like a real error. The current procedure's error handler is activated, unless it is already active or there isn't one. In that case the calling procedure's error handler is tried. (Use Err.Raise to provide complete error information.) · Function: The Error( ) function returns the error text string. Parameters: ErrorCode—Return the absolute value of this numeric value. If this value is Null then Null is returned. Example: Sub Main Problem: ' error handler |
ErrorToString |
Syntax: ErrorToString(ErrorCode) Group: Error Handling Description: The ErrorToString function returns the error text string. Parameters: ErrorCode—This is the error number. Example: Sub Main On Error GoTo Problem Error 1 ' simulate error #1 Exit Sub Problem: ' error handler Debug.Print "Description="; ErrorToString(Err.Num) Resume Next End Sub |
Eval |
Syntax: Eval(Expr[, Depth]) Group: Miscellaneous Description: Return the value of the string expression as evaluated. Parameters: Expr—Evaluate this string value. Depth—This integer value indicates how deep into the stack to locate the local veriables. If Depth = 0 then use the current procedure. If this value is omitted then the depth is 0. Example: Sub Main Sub A |
Exp |
Syntax: Exp(Num) Group: Math Description: Return the exponential. Parameters: Num—Return e raised to the power of this numeric value. The value e is approximately 2.718282. Example: Sub Main |
FileAttr |
Syntax: FileAttr(StreamNum, ReturnValue) Group: File Description: Return StreamNum's open mode or file handle. Parameters: StreamNum—Streams 1 through 255 are private to each macro. Streams 256 through 511 are shared by all macros. ReturnValue—1 - return the mode used to open the file: 1=Input, 2=Output, 4=Random, 8=Append, 32=Binary 2 - return the file handle Example: Sub Main |
FileDateTime |
Syntax: FileDateTime(Name$) Group: File Description: Return the date and time file Name$ was last changed as a Date value. If the file does not exist then a run-time error occurs. Parameters: 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 |
FileLen |
Syntax: FileLen(Name$) Group: File Description: Return the length of file Name$. If the file does not exist then a run-time error occurs. Parameters: 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 |
Fix |
Syntax: Fix(Num) Group: Math Description: Return the integer value. Parameters: Num—Return the integer portion of this numeric value. The number is truncated. Positive numbers return the next lower integer. Negative numbers return the next higher integer. If this value is Null then Null is returned. Example: Sub Main |
Format |
Syntax: Format[$](expr[, form$], [firstday], [firstweek]) Group: String Description: Return the formatted string representation of expr. Parameters: expr—Return the formatted string representation of this numeric value. form—Format expr using to this string value. If this is omitted then return the expr as a string. firstday—Format using this day as the first day of the week. If this is omitted then the vbSunday is used. firstweek—Format using this week as the first week of the year. If this is omitted then the vbFirstJan1 is used. firstday—Value—Description (Return value range) vbUseSystemFirstDay—0—Use the systems first day of the week. vbSunday—1—Sunday (default) vbMonday—2—Monday vbTuesday—3—Tuesday vbWednesday—4—Wednesday vbThursday—5—Thursday vbFriday—6—Friday vbSaturday—7—Saturday firstweek—Value—Description (Return value range) vbUseSystem—0—Use the systems first day of the week. vbFirstJan1—1—Sunday (default) 2—vbFirstFourDays—Monday 3—vbFirstFullWeek—Tuesday |
FreeFile |
Syntax: FreeFile[( )] Group: File Description: Return the next unused shared stream number (greater than or equal to 256). Streams 1 through 255 are private to each macro. Streams 256 through 511 are shared by all macros. Example: Sub Main |
GetAllSettings |
Syntax: GetAllSettings(AppName$, Section$, Key$) Group: Settings Description: Get all of Section's settings in project AppName. Settings are returned in a Variant. Empty is returned if there are no keys in the section. Otherwise, the Variant contains a two dimension array: (I,0) is the key and (I,1) is the setting. Win16 and Win32s store settings in a.ini file named AppName. Win32 stores settings in the registration database. 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. Example: Sub Main |
GetAttr |
Syntax: GetAttr(Name$) Group: File Description: Return the attributes for file Name$. If the file does not exist then a run-time error occurs. Parameters: 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 |
GetChar |
Syntax: GetChar(Str, Index) Group: String Description: Return the character at Index. The first char is at Index=1. Parameters: Str—Index into this string value. Index—This is the index into the string value. Example: Sub Main |
GetFilePath |
Syntax: GetFilePath[$]([DefName$], [DefExt$], [DefDir$], [Title$], [Option]) Group: User Input Description: Put up a dialog box and get a file path from the user. The returned string is a complete path and file name. If Cancel is pressed then a null string is returned. Parameters: DefName$—Set the initial File Name in the to this string value. If this is omitted then *.DefExt$ is used. DefExt$—Initially show files whose extension matches this string value. (Multiple extensions can be specified by using ";" as the separator.) If this is omitted then * is used. A "filter" may be specified using "description|*.ext|". Multiple descriptions can be used by repeating this format. (e.g., "Bitmap files|*.bmp|PNG files|*.png|JPEG files|*.jpg") DefDir$—This string value is the initial directory. If this is omitted then the current directory is used. Title$—This string value is the title of the dialog. If this is omitted then "Get File Path" is used. Option—This numeric value determines the file selection options. If this is omitted then zero is used. See table below. Option—Effect 0—Only allow the user to select a file that exists. 1—Confirm creation when the user selects a file that does not exist. 2—Allow the user to select any file whether it exists or not. 3—Confirm overwrite when the user selects a file that exists. 4—Selecting a different directory changes the application's current directory. Example: Sub Main |
GetLocale |
Syntax: GetLocale Group: Miscellaneous Description: Get the locale ID for the current thread. Example: Sub Main SetLocale &H409 ' English, US Debug.Print Hex(GetLocale) '"409" |
GetObject |
Syntax: GetObject([File$][, Class$]) Group: Object Description: Get an existing object of type Class$ from File$. Use Set to assign the returned object to an object variable. Parameters: File$—This is the file where the object resides. If this is omitted then the currently active object for Class$ is returned. Class$—This string value is the application's registered class name. If this application is not currently active it will be started. If this is omitted then the application associated with the file's extension will be started. Example: Sub Main |
GetSetting |
Syntax: GetSetting[$](AppName$, Section$, Key$[, Default$]) Group: Settings Description: Get the setting for Key in Section in project AppName. Win16 and Win32s store settings in a.ini file named AppName. Win32 stores settings in the registration database. 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. Default$—Return this string value if no setting has been saved. If this is omitted then a null string is used. Example: Sub Main |
Hex |
Syntax: Hex[$](Num) Group: String Description: Return a hex string. Parameters: Num—Return a hex encoded string for this numeric value. Example: Sub Main |
Hour |
Syntax: Hour(dateexpr) Group: Time/Date Description: Return the hour of the day (0 to 23). Parameters: dateexpr—Return the hour of the day for this date value. If this value is Null then Null is returned. Example: Sub Main |
IIf |
Syntax: IIf(condexpr, TruePart, FalsePart) Group: Miscellaneous Description: Return the value of the parameter indicated by condexpr. Both TruePart and FalsePart are evaluated. Parameters: condexpr—If this value is True then return TruePart. Otherwise, return FalsePart. TruePart—Return this value if condexpr is True. FalsePart—Return this value if condexpr is False. See Also: If, Select Case, Choose( ). Example: Sub Main |
Input |
Syntax: Input[$](N, StreamNum) Group: File Description: Return N chars from StreamNum. Parameters: N—Read this many chars. If fewer than that many chars are left before the end of file then a run-time error occurs. StreamNum—Streams 1 through 255 are private to each macro. Streams 256 through 511 are shared by all macros. Example: Sub Main |
InputBox |
Syntax: InputBox[$](Prompt$[, Title$][, Default$][, XPos, YPos]) Group: User Input Description: Display an input box where the user can enter a line of text. Pressing the OK button returns the string entered. Pressing Cancel returns a null string. Parameters: Prompt$—Use this string value as the prompt in the input box. Title$—Use this string value as the title of the input box. If this is omitted then the input box does not have a title. Default$—Use this string value as the initial value in the input box. If this is omitted then the initial value is blank. XPos—When the dialog is put up the left edge will be at this screen position. If this is omitted then the dialog will be centered. YPos—When the dialog is put up the top edge will be at this screen position. If this is omitted then the dialog will be centered. Example: Sub Main |
InputString |
Syntax: InputString(StreamNum, N) Group: File Description: Return N chars from StreamNum. Parameters: StreamNum—Streams 1 through 255 are private to each macro. Streams 256 through 511 are shared by all macros. N—Return a hex encoded string for this numeric value. Example: Sub Main DimL, T L = LOrF(1) T = InputString(1,L) FileClose 1 Debug.Print T; |
InStr |
Syntax: InStr([Index, ]S1$, S2$) Group: String Description: Return the index where S2$ first matches S1$. If no match is found return 0. Parameters: Index—Start searching for S2$ at this index in S1$. If this is omitted then start searching from the beginning of S1$. S1$—Search for S2$ in this string value. If this value is Null then Null is returned. S2$—Search S1$ for this string value. If this value is Null then Null is returned. Example: Sub Main |
InStrRev |
Syntax: InStrRev(S1$, S2$[, Index]) Group: String Description: Return the index where S2$ last matches S1$. If no match is found return 0. Parameters: S1$—Search for S2$ in this string value. If this value is Null then Null is returned. S2$—Search S1$ for this string value. If this value is Null then Null is returned. Index—Start searching for S2$ ending at this index in S1$. If this is omitted then start searching from the end of S1$. See Also: Left$( ), Len( ), Mid$( ), Replace$( ), Right$( ). Example: Sub Main |
Int |
Syntax: Int(Num) Group: Math Description: Return the integer value. Parameters: Num—Return the largest integer which is less than or equal to this numeric value. If this value is Null then Null is returned. Example: Sub Main |
IsArray |
Syntax: IsArray(var) Group: Variable Info Description: Return the True if var is an array of values. Parameters: var—A array variable or a variant var can contain multiple of values. Example: Sub Main |
IsDate |
Syntax: IsDate(expr) Group: Variable Info Description: Return the True if expr is a valid date. Parameters: expr—A variant expression to test for a valid date. Example: Sub Main |
IsDBNull |
Syntax: IsDBNull(expr) Group: Variable Info Description: Returns True if expr is System.DBNull.Value.. Parameters: expr—A variant expression to test for System.DBNull.Value. Example: Sub Main Debug.Print IsEmpty(X) 'True Debug.Print IsDBNull(X) 'False X = 1 Debug.Print IsDBNull(X) 'False X = "1" Debug.Print IsDBNull(X) 'False X = System.DBNull.Value Debug.Print IsDBNull(X) 'True X = X*2 Debug.Print IsDBNull(X) 'True |
IsEmpty |
Syntax: IsEmpty(variantvar) Group: Variable Info Description: Return the True if variantvar is Empty. Parameters: Name$—A variant var is Empty if it has never been assigned a value. Example: Sub Main |
IsError |
Syntax: IsError(expr) Group: Variable Info Description: Return the True if expr is an error code. Parameters: expr—A variant expression to test for an error code value. Example: Sub Main |
IsMissing |
Syntax: IsMissing(expr) Group: Variable Info Description: Return the True if Optional parameter expr does not have a default value and it did not get a value. An Optional parameter may be omitted in the Sub, Function or Property call. Parameters: expr—Return True if this variant parameter's argument expression was not specified in the Sub, Function or Property call. Example: Sub Main Sub Opt(Optional A) Sub Many(ParamArray A()) Sub OptBye(Optional A As String = "Bye") |
IsNothing |
Syntax: IsNothing(expr) Group: Variable Info Description: Returns True if the expr contains an object reference which is Nothing. Parameters: var—If objexpr reference is Nothing returns True. Example: Sub Main DimX As Object X = 1 Debug.Print IsNothing(X) 'False X = "1" Debug.Print IsNothing(X) 'False X = Nothing Debug.Print IsNothing(X) 'True |
IsNull |
Syntax: IsNull(expr) Group: Variable Info Description: Return the True if expr is Null. Parameters: expr—A variant expression to test for Null. Example: Sub Main |
IsNumeric |
Syntax: IsNumeric(expr) Group: Variable Info Description: Return the True if expr is a numeric value. Parameters: expr—A variant expression is a numeric value if it is numeric or string value that represents a number. Example: Sub Main |
IsObject |
Syntax: IsObject(var) Group: Variable Info Description: Return the True if var contains an object reference. Parameters: var—A var contains an object reference if it is objexpr reference. Example: Sub Main |
IsReference |
Syntax: IsReference(expr) Group: Variable Info Description: Returns True if the expr contains an object reference. Parameters: var—If expris an object reference return True. Example: Sub Main X = 1 Debug.Print IsReference(X) 'False X = "1" Debug.Print IsReference(X) 'False X = Nothing Debug.Print IsReference(X) 'True |
Join |
Syntax: Join(StrArray, [Sep]) Group: Miscellaneous Description: Return a string by concatenating all the values in the array with Sep between each one. Parameters: StrArray—Concatenate values from this array. Sep—Use this string value to separate the values. (Default: " ") Example: Sub Main |
KeyName |
Syntax: KeyName(Key) Group: Miscellaneous Description: Return the key name for a key number. This is the name used by SendKeys. Parameters: Key—Key number. Example: Sub Main |
LBound |
Syntax: LBound(arrayvar[, dimension]) Group: Variable Info Description: Return the lowest index. Parameters: arrayvar—Return the lowest index for this array variable. dimension—Return the lowest index for this dimension of arrayvar. If this is omitted then return the lowest index for the first dimension. Example: Sub Main |
LCase |
Syntax: LCase[$](S$) Group: String Description: Return a string from S$ where all the uppercase letters have been lowercased. Parameters: S$—Return the string value of this after all chars have been converted to lowercase. If this value is Null then Null is returned. Example: Sub Main |
Left |
Syntax: Left[$](S$, Len) Group: String Description: Return a string from S$ with only the Len chars. Parameters: S$—Return the left portion of this string value. If this value is Null then Null is returned. Len—Return this many chars. If S$ is shorter than that then just return S$. Example: Sub Main |
Len |
Syntax: Len(S$) -or- Len(usertypevar) Group: String Description: Return the number of characters in S$. Parameters: S$—Return the number of chars in this string value. If this value is Null then Null is returned. usertypevar—Return the number of bytes required to store this user type variable. If the user type has any dynamic String and Variant elements the length returned may not be as big as the actual number of bytes required. Example: Sub Main |
LineInput |
Syntax: LineInput(StreamNum) Group: File Description: Get a line of input from StreamNum. Example: Sub Main Dim S As String S = LineInput(1) Debug.Print S FileClose 1 End Sub |
Loc |
Syntax: Loc(StreamNum) Group: File Description: Return StreamNum file position. For Random mode files this is the current record number minus one. For Binary mode files it is the current byte position minus one. Otherwise, it is the current byte position minus one divided by 128. The first position in the file is 0. Parameters: StreamNum—Streams 1 through 255 are private to each macro. Streams 256 through 511 are shared by all macros. Example: Sub Main |
LOF |
Syntax: LOF(StreamNum) Group: File Description: Return StreamNum file length (in bytes). Parameters: StreamNum—Streams 1 through 255 are private to each macro. Streams 256 through 511 are shared by all macros. Example: Sub Main |
Log |
Syntax: Log(Num) Group: Math Description: Return the natural logarithm. Parameters: Num—Return the natural logarithm of this numeric value. The value e is approximately 2.718282. Example: Sub Main |
LSet |
Syntax: LSet(S, var) Group: String Description: Return a string from S with only the Len chars. Parameters: S—Return the left portion of this string value. var—Return this many chars. If S is shorter than that then fill the remainder with spaces Example: Sub Main End Sub |
LTrim |
Syntax: LTrim[$](S$) Group: String Description: Return the string with S$'s leading spaces removed. Parameters: S$—Copy this string without the leading spaces. If this value is Null then Null is returned. Example: Sub Main |
MacroCheck |
Syntax: MacroCheck(MacroName$) Group: Flow Control Description: Check the syntax of a macro/module. Does not execute the macro/module. Returns an Err object if there is a syntax error, otherwise Nothing is returned. Parameters: MacroName$—Check the macro named by this string value. Example: Sub Main Set E = MacroCheck("Demo") If Not E Is Nothing Then Debug.Print E.Description |
MacroCheckThis |
Syntax: MacroCheckThis(MacroCode$) Group: MacroName$ Description: Return the True if expr is a numeric value. Parameters: MacroName$—Check the macro code in this string value. Example: Sub Main Set E = MacroCheckThis("bad macro") If Not E Is Nothing Then Debug.Print E.Description |
MacroDir |
Syntax: MacroDir[$] Group: Flow Control Description: Return the directory of the current macro. A run-time error occurs if the current macro has never been saved. Example: Sub Main |
Mid Function/Assignment |
Syntax: Mid[$](S$, Index[, Len]) -or- Mid[$](strvar, Index[, Len]) = S$ Group: String Description: Function: Return the substring of S$ starting at Index for Len chars. Instruction: Assign S$ to the substring in strvar starting at Index for Len chars. Note: A similar function, MidB, returns the Len bytes starting a byte Index. Parameters: (Mid Function) S$—Copy chars from this string value. If this value is Null then Null is returned. Index—Start copying chars starting at this index value. If the string is not that long then return a null string. Len—Copy this many chars. If the S$ does not have that many chars starting at Index then copy the remainder of S$. Parameters: (Mid Assignment) strvar—Copy chars from this string value. If this value is Null then Null is returned. Index—Change strvar starting at this index value. If the string is not that long then it is not changed. S$—Copy chars from this string value. Len—The number of chars copied is smallest of: the value of Len, the length of S$ and the remaining length of strvar. (If this value is omitted then the number of chars copied is the smallest of: the length of S$ and the remaining length of strvar.) Example: Sub Main |
Minute |
Syntax: Minute(dateexpr) Group: Time/Date Description: Return the minute of the hour (0 to 59). Parameters: dateexpr—Return the minute of the hour for this date value. If this value is Null then Null is returned. Example: Sub Main |
ModuleLoad |
Syntax: ModuleLoad(ModuleName$, CreateNew) Group: Flow Control Description: Load a module. Does not execute the module. Macro's can not be loaded. Returns an object if successful, otherwise Nothing is returned. Parameters: MacroName$—Check the macro named by this string value. Example: Sub Main Set E = MacroCheckThis("Demo") If Not E Is Nothing Then Debug.Print E.Description |
ModuleLoadThis |
Syntax: ModuleLoadThis(ModuleCode$, CreateNew) Group: Flow Control Description: Load ModuleCode as a module. Does not execute the module. Macro's can not be loaded. Returns an object if successful, otherwise Nothing is returned. Parameters: ModuleCode$—Load the module code in this string value. CreateNew—Return a new instance if True. Otherwise return the default instance. A class module does not have a default instance. A code module can not have a new instance. Example: Sub Main Set Obj = ModuleLoadThis("Sub DoIt" & vbCrLf & "End Sub") Obj.DoIt ' call Demo's DoIt method |
Month |
Syntax: Month(dateexpr) Group: Time/Date Description: Return the month of the year (1 to 12) Parameters: dateexpr—Return the month of the year for this date value. If this value is Null then Null is returned. Example: Sub Main |
MonthName |
Syntax: MonthName(NumZ{month}[, CondZ{abbrev}]) Group: Time/Date Description: Return the localized name of the month. Parameters: month—Return the localized name of this month. (1-12) abbrev—If this conditional value is True then return the abbreviated form of the month name. Example: Sub Main |
MsgBox Instruction/Function |
Syntax: MsgBox Message$[, Type][, Title$] -or- MsgBox(Message$[, Type][, Title$]) Group: User Input Description: Show a message box titled Title$. Type controls what the message box looks like (choose one value from each category). Use MsgBox( ) if you need to know what button was pressed. The result indicates which button was pressed. Result—Value—Button Pressed vbOK—1—OK button vbCancel—2—Cancel button vbAbort—3—Abort button vbRetry—4—Retry button vbIgnore—5—Ignore button vbYes—6—Yes button vbNo—7—No button Parameters: Message$—This string value is the text that is shown in the message box. Type—This numeric value controls the type of message box. Choose one value from each of the following tables. Title$—This string value is the title of the message box. Button—Value—Effect vbOkOnly—1—OK button vbOkCancel—2—OK and Cancel buttons vbAbortRetryIgnore—3—Abort, Retry, Ignore buttons vbYesNoCancel—4—Yes, No, Cancel buttons vbYesNo—5—Yes and No buttons vbRetryCancel—6—Retry and Cancel buttons Icon—Value—Effect —0—No icon vbCritical—16—Stop icon vbQuestion—3—Question icon vbExclamation—4—Attention icon vbInformation—5—Information icon Default—Value—Effect vbDefaultButton1—0—First button vbDefaultButton2—256—Second button vbDefaultButton3—512—Third button Default—Value—Effect vbApplicationModal—0—Application modal vbSystemModal—4096—System modal vbMsgBoxSetForeground—&h10000—Show message box in front of all other windows Example: Sub Main |
Now |
Syntax: Now Group: Time/Date Description: Return the current date and time as a date value. Example: Sub Main |
Oct |
Syntax: Oct[$](Num) Group: String Description: Return an octal string. Parameters: Num—Return an octal encoded string for this numeric value. Example: Sub Main |
QBColor |
Syntax: QBColor(num) Group: Miscellaneous Description: Return the appropriate color defined by Quick Basic. num—color 0—black 1—blue 2—green 3—cyan 4—red 5—magenta 6—yellow 7—white 8—gray 9—light blue 10—light green 11—light cyan 12—light red 13—light magenta 14—light yellow 15—bright white Example: Sub Main |
Replace |
Syntax: Replace[$](S$, Pat$, Rep$, [Index], [Count]) Group: String Description: Replace Pat$ with Rep$ in S$. Parameters: S$—This string value is searched. Replacements are made in the string returned by Replace. Pat$—This string value is the pattern to look for. Rep$—This string value is the replacement. Index—This numeric value is the starting index in S$. Replace(S,Pat,Rep,N) is equivalent to Replace(Mid(S,N),Pat,Rep). If this is omitted use 1. Count—This numeric value is the maximum number of replacements that will be done. If this is omitted use -1 (which means replace all occurrences). Example: Sub Main |
RGB |
Syntax: RGB(red, green, blue) Group: Miscellaneous Description: Return a color. Some useful color constants are predefined: Color—RGB vbBlack—same as RGB(0,0,0) vbRed—same as RGB(255,0,0) vbGreen—same as RGB(0,255,0) vbYellow—same as RGB(255,255,0) vbBlue—same as RGB(0,0,255) vbMagenta—same as RGB(255,0,255) vbCyan—same as RGB(0,255,255) vbWhite—same as RGB(255,255,255) Example: Sub Main |
Right |
Syntax: Right[$](S$, Len) Group: String Description: Return the last Len chars of S$. NOTE: A similar function, RightB, returns the last Len bytes. Parameters: S$—Return the right portion of this string value. If this value is Null then Null is returned. Len—Return this many chars. If S$ is shorter than that then just return S$. Example: Sub Main |
Rnd |
Syntax: Rnd([Num]) Group: Math Description: Return a random number greater than or equal to zero and less than one. NOTE: This function does not return properly randomized numbers unless Randomize is called first with a suitable seed. To avoid this problem and generate random numbers with ease, use RndEx, RndInt or RndFloat. Parameters: Num—See table below. Num—Description <0—Return the same number every time, using Num as the seed. >0—Return the next random number in the sequence. 0—Return the most recently generated number. omitted—Return the next random number in the sequence. Example: Sub Main |
Round |
Syntax: Round([Num][, Places]) Group: Math Description: Return the number rounded to the specified number of decimal places. Parameters: Num—Round this numeric value. If this value is Null then Null is returned. Places—Round to this number of decimal places. If this is omitted then round to the nearest integer value. Example: Sub Main |
RSet |
Syntax: RSet(S, Len) Group: String Description: Return a string from S with only the Len chars. Parameters: S—Return this string value right justified. Len—Return this many chars. If S is shorter than that, then fill the remainder with spaces. Example: Sub Main |
RTrim |
Syntax: RTrim[$](S$) Group: String Description: Return the string with Sr$'s trailing spaces removed. Parameters: S$—Copy this string without the trailing spaces. If this value is Null then Null is returned. Example: Sub Main |
Second |
Syntax: Second(dateexpr) Group: Time/Date Description: Return the second of the minute (0 to 59). Parameters: dateexpr—Return the second of the minute for this date value. If this value is Null then Null is returned. Example: Sub Main |
Seek |
Syntax: Seek(StreamNum) Group: File Description: Return StreamNum current position. 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. NOTE: Unicode text files opened with Input mode use character positions, not byte positions. Parameters: StreamNum—Streams 1 through 255 are private to each macro. Streams 256 through 511 are shared by all macros. Example: Sub Main |
Sgn |
Syntax: Sgn(Num) Group: Math Description: Return the sign. Parameters: Num—Return the sign of this numeric value. Return -1 for negative. Return 0 for zero. Return 1 for positive. Example: Sub Main |
Shell |
Syntax: Shell(Name$[, WindowType]) Group: Miscellaneous Description: Execute program Name$. This is the same as using File|Run from the Program Manager. This instruction can run.COM,.EXE,.BAT and.PIF files. If successful, return the task ID. Parameter Description Name$ This string value is the path and name of the program to run. Command line arguments follow the program name. (A long file name containing a space must be surrounded by literal double quotes.) WindowType This controls how the application's main window is shown. See the table below. WindowType—Value—Effect vbHide—0—Hide Window vbNormalFocus—1,5,9—Normal Window vbMinimizedFocus—2—Minimized Window (default) vbMaximizedFocus—3—Maximized Window vbNormalNoFocus—4,8—Normal Deactivated Window vbMinimizedNoFocus—6,7—Minimized Deactivated Window Example: Sub Main |
ShowPopupMenu |
Syntax: ShowPopupMenu(StrArray$( )[, PopupStyle][, XPos, YPos]) Group: User Input Description: Parameter Description StrArray$( ) This one-dimensional array of strings establishes the list of choices. All the non-null elements of the array are used. PopupMenuStyle This controls how the popup menu is aligned. Any combination of styles may used together. See the table below. XPos When the menu is put up the alignment will be at this window position. If this is omitted then the current mouse position is used. YPos When the menu is put up the alignment will be at this window position. If this is omitted then the current mouse position is used. PopupStyle Value Effect vbPopupLeftTopAlign 0 Align menu left edge at XPos and top at YPos. (default) vbPopupUseLeftButton 1 User can select menu choices with the left mouse button only. vbPopupUseRightButton 2 User can select menu choices with the left or right mouse button. vbPopupRightAlign 4 Align menu with right edge at the XPos. vbPopupCenterAlign 8 Align menu center at the XPos. vbPopupVCenterAlign 16 Align menu center at the YPos. vbPopupBottomAlign 32 Align menu bottom at the YPos. Example: Sub Main |
Sin |
Syntax: Sin(Num) Group: Math Description: Return the sine. Parameters: Num—Return the sine of this numeric value. This is the number of radians. There are 2*Pi radians in a full circle. Example: Sub Main |
Space |
Syntax: Space[$](Len) Group: String Description: Return the string Len spaces long. Parameters: Len—Create a string this many spaces long. Example: Sub Main |
Split |
Syntax: Split(Str, [Sep], [Max]) Group: Miscellaneous Description: Return a string array containing substrings from the original string. Parameters: Str—Extract substrings from this string value. Sep—Look for this string value to separate the substrings. (Default: " ") Max—Create at most this many substrings. (Default -1, which means create as many as are found.) Example: Sub Main |
Sqr |
Syntax: Sqr(Num) Group: Math Description: Return the square root. Parameters: Num—Return the square root of this numeric value. Example: Sub Main |
Str$ |
Syntax: Str[$](Num) Group: String Description: Return the string representation of Num. Parameters: Len—Return the string representation of this numeric value. Positive values begin with a blank. Negative values begin with a dash '-'. Example: Sub Main |
StrComp |
Syntax: StrComp(Str1,Str2,Comp) Group: String Description: Compare two strings. Parameters: Str1—Compare this string with Str2. If this value is Null then Null is returned. Str2—Compare this string with Str1. If this value is Null then Null is returned. Comp—This numeric value indicates the type of comparison. See Comp table below. Result—Description -1—Str1 is less than Str2. 0—Str1 is equal to Str2. 1—Str1 is greater than Str2. Null—Str1 or Str2 is Null. Comp—Value—Effect vbUseCompareOption—-1—Performs the comparison using the Option Compare statement value. vbBinaryCompare—0—Compares the string's binary data. vbTextCompare—1—Compares the string's text using the collation rules. vbDatabaseCompare—2—Microsoft Access only. (Not supported.) Example: Sub Main |
StrConv |
Syntax: StrConv[$](Str,Conv) Group: String Description: Convert the string. Parameters: Str—Convert this string value. If this value is Null then Null is returned. Conv—This numeric value indicates the type of conversion. See conversion table below. Conv—Value—Effect vbUpperCase—1—Convert a String to upper case. vbLowerCase—2—Convert a String to lower case. vbProperCase—3—Convert a String to proper case. (Not supported.) vbWide—4—Convert a String to wide. (Only supported for eastern locales.) vbNarrow—8—Convert a String to narrow. (Only supported for eastern locales.) vbKatakana—16—Convert a String to Katakana. (Only supported for Japanese locales.) vbHiragana—32—Convert a String to Hiragana. (Only supported for Japanese locales.) vbUnicode or vbFromANSIBytes—64—Convert an ANSI (locale dependent) byte array to a Unicode string. vbANSI—4160—Convert an ANSI (locale dependent) string to a Unicode string. vbFromUnicode or vbANSIBytes—128—Convert from Unicode to an ANSI (locale dependent) byte array. vbANSI—4224—Convert from Unicode to an ANSI (locale dependent) string. vbUTF8—4352—Convert a Unicode string to a UTF-8 byte array. vbUTF8Bytes—256—Convert a Unicode string to a UTF-8 string. vbFromUTF8—4608—Convert a UTF-8 string to a Unicode string. vbFromUTF8Bytes—512—Convert a UTF-8 byte array to a Unicode string. vbToBytes—1024—Convert a String to a byte array containing the low byte of each char. vbFromBytes—2048—Convert a byte array to a String by setting the low byte of each char. Conversion Rules: If multiple conversions are specified, the conversions occur in this order: vbFromBytes, vbUnicode, vbFromANSI, vbFromANSIBytes, vbFromUTF8 or vbFromUTF8Bytes (choose one, optional) vbUpperCase, vbLowerCase, vbWide, vbNarrow, vbKatakana or vbHiragana (choose one or more, optional) vbToBytes, vbFromUnicode, vbANSI, vbANSIBytes, vbUTF8 or vbUTF8Bytes (choose one, optional) Example: Sub Main StrConv$(B,vbUnicode) '"ABC" |
StrDup |
Syntax: StrDup(Len, char) Group: String Description: Return the string Len long filled with char or the first char of char. Parameters: Len—Create a string this many chars long. char—Fill the string with this char value. If this is a numeric value then use the ASCII char equivalent. If this is a string value use the first char of that string. Example: Sub Main Debug.Print StrDup(4,"ABC") '"AAAA" End Sub |
String |
Syntax: String[$](Len, Char) Group: String Description: Return the string Len long filled with Char or the first char of Char$. Parameters: Len—Create a string this many chars long. Char—Fill the string with this char value. If this is a numeric value then use the ASCII char equivalent. If this is a string value use the first char of that string. If this value is Null then Null is returned. Example: Sub Main |
StrReverse |
Syntax: StrReverse[$](S) Group: String Description: Return the string with the characters in reverse order. Parameters: S—Return this string with the characters in reverse order. Example: Sub Main |
SystemTypeName |
Syntax: SystemTypeName(Name) Group: Variable Info Description: Return a fully qualified Common Language Runtime type name corresponding to the VB type name. Return Nothing if the specified Name is not a valid VB type Name. Parameters: Name—This is the VB type name. Example: Sub Main Debug.Print SystemTypeName(X) '"Empty" X = 1 Debug.Print SystemTypeName(X) '"Integer" |
Tan Function |
Syntax: Tan(Num) Group: Math Description: Return the tangent. Parameters: Num—Return the tangent of this numeric value. Example: Sub Main |
Time |
Syntax: Time[$] Group: Time/Date Description: Return the current time as a date value. Example: Sub Main |
Timer |
Syntax: Timer Group: Time/Date Description: Return the number of seconds past midnight. (This is a real number, accurate to about 1/18th of a second.) Example: Sub Main |
TimeSerial |
Syntax: TimeSerial(Hour, Minute, Second) Group: Time/Date Description: Return a date value. Parameters: Hour—This numeric value is the hour (0 to 23). Minute—This numeric value is the minute (0 to 59). Second—This numeric value is the second (0 to 59). Example: Sub Main |
TimeValue |
Syntax: TimeValue(Date$) Group: Time/Date Description: Return the time part of date encoded as a string value. Parameters: Date$—Convert this string value to the time part of date it represents. Example: Sub Main |
TryCast |
Syntax: TryCast(expr, objtype) Group: Conversion Description: Return expr's type is related to objtype type. If it is not, nothing will be returned. Parameters: expr—Cast the value of this expression. objtype—Cast to this type. Example: Sub Main V = Err Debug.Print TypeName(TryCast(V, ErrObject)) ' ErrObject |
Trim |
Syntax: Trim[$](S$) Group: String Description: Return the string with S$'s leading and trailing spaces removed. Parameters: S$—Copy this string without the leading or trailing spaces. If this value is Null then Null is returned. Example: Sub Main |
TypeName |
Syntax: TypeName[$](var) Group: Variable Info Description: Return a string indicating the type of value stored in var. Parameters: var—Return a string indicating the type of value stored in this variable. Result—Description Empty—Variant variable is empty. It has never been assigned a value. Null—Variant variable is null. Boolean—Variable contains an integer value. Byte—Variable contains a single value. SByte—Variable contains a single value. Short—Variable contains a byte value. Integer—Variable contains an Integer value. Long—Variable contains a long value. Decimal—Variable contains a Decimal value. Single—Variable contains a single value. Double—Variable contains a double value. Currency—Variable contains a currency value. Date—Variable contains a date value. String—Variable contains a string value. Object—Variable contains an object reference that is not Nothing. (An object may return a type name specific to that type of object.) Nothing—Variable contains an object reference that is Nothing. Byte—Variable contains a byte value. Error—Variable contains a error code value. Variant—Variable contains a variant value. (Only used for arrays of variants.) Unknown—Variable contains a non-ActiveX Automation object reference. ( )—Variable contains an array value. The TypeName of the element followed by ( ). Example: Sub Main |
UBound |
Syntax: UBound(arrayvar[, dimension]) Group: Variable Info Description: Return the highest index. Parameters: arrayvar—Return the highest index for this array variable. dimension—Return the highest index for this dimension of arrayvar. If this is omitted then return the highest index for the first dimension. Example: Sub Main |
UCase |
Syntax: UCase[$](S$) Group: String Description: Return a string from S$ where all the lowercase letters have been uppercased. Parameters: S$—Return the string value of this after all chars have been converted to lowercase. If this value is Null then Null is returned. Example: Sub Main |
Val |
Syntax: Val(S$) Group: String Description: Return the value of the S$. Parameters: S$—Return the numeric value for this string value. A string value begins with &O is an octal number. A string value begins with &H is a hex number. Otherwise it is decimal number. Example: Sub Main |
VarType |
Syntax: VarType(var) Group: Variable Info Description: Return a number indicating the type of value stored in var. Parameters: var—Return a number indicating the type of value stored in this variable. Result—Value—Description vbEmpty—0—Variant variable is empty. It has never been assigned a value. vbNull—1—Variant variable is null. vbInteger—2—Variable contains an integer value. vbLong—3—Variable contains a long value. vbSingle—4—Variable contains a single value. vbDouble—5—Variable contains a double value. vbCurrency—6—Variable contains a currency value. vbDate—7—Variable contains a date value. vbString—8—Variable contains a string value. vbObject—9—Variable contains an object reference. vbError—10—Variable contains a error code value. vbBoolean—11—Variable contains a boolean value. vbVariant—12—Variable contains a variant value. (Only used for arrays of variants.) vbDataObject—13—Variable contains a non-ActiveX Automation object reference. vbDecimal—14—Variable contains a 96 bit scaled real. vbByte—16—Variable contains a byte value. vbUserDefinedType—36—Variable contains a User Defined Type value. vbArray—8192—Variable contains an array value. Use VarType( ) And 255 to get the type of element stored in the array. Example: Sub Main |
VbTypeName |
Syntax: VbTypeName(Name) Group: Variable Info Description: Returns a string indicating VB type name corresponding to the fully qualified Common Language Runtime type name. Returns Nothing if the specified Name is not a valid VB type name. Parameters: Name—This is Common Language Runtime type name. Example: Sub Main Debug.Print VbTypeName(X) '"Empty" X = 1 Debug.Print VbTypeName(X) '"Integer" |
Weekday |
Syntax: Weekday(dateexpr) Group: Time/Date Description: Return the weekday. Parameters: dateexpr—Return the weekday for this date value. If this value is Null then Null is returned. firstday—Value—Description (Return value) vbSunday—1—Sunday vbMonday—2—Monday vbTuesday—3—Tuesday vbWednesday—4—Wednesday vbThursday—5—Thursday vbFriday—6—Friday vbSaturday—7—Saturday Example: Sub Main |
WeekdayName |
Syntax: WeekdayName(NumZ{day}[, CondZ{abbrev}]) Group: Time/Date Description: Return the localized name of the weekday. Parameters: day—Return the localized name of this weekday. (1-7) abbrev—If this conditional value is True then return the abbreviated form of the weekday name. Example: Sub Main |
Year |
Syntax: Year(dateexpr) Group: Time/Date Description: Return the year. Parameters: dateexpr—Return the year for this date value. If this value is Null then Null is returned. Example: Sub Main |