VBScripts keywords

 
 

Keyword/Feature Description

Array Handling
Dim Declare an array
ReDim Redimension an array
Private Declare a private script level array
Public Declare a public array at script level
IsArray Returns True if a variable is an array
Erase Reinitializes a fixed-size array
LBound Returns the lower bound of an array
UBound Returns the upper bound of an array


Assignments
= Assigns a value to a variable
Let Assigns a value to a variable
Set Assigns an object to a variable


Comments
' Include inline comments in your script
Rem Include comments in your script


Constants/Literals
Empty Indicates an uninitialized variable
Nothing Disassociate a variable with an object
Null Indicates a variable with no data
True Boolean True (value equal to -1)
False Boolean False (value equal to 0)


Control Flow
Do...Loop Repeats a block of statements
For...Next Repeats a block of statements
For Each...Next Repeats a block of statements
If...Then...Else Conditionally executes statements
Select Case Conditionally executes statements
While...Wend Repeats a block of statements


Conversions
Abs Returns absolute value of a number
Asc Returns the ASCII code of a character
AscB Returns the ASCII code of a character
AscW Returns the ASCII code of a character
Chr Returns a character from an ASCII code
ChrB Returns a character from an ASCII code
ChrW Returns a character from an ASCII code
CBool Converts a variant to a Boolean
CByte Converts a variant to a byte
CDate Converts a variant to a date
CDbl Converts a variant to a double
CInt Converts a variant to an integer
CLng Converts a variant to a long
CSng Converts a variant to a single
CStr Converts a variant to a string
DateSerial Converts a variant to a date
DateValue Converts a variant to a date
Hex Converts a variant to a hex string
Oct Converts a variant to a octal string
Fix Converts a variant to a fixed string
Int Converts a variant to a integer string
Sgn Converts a variant to a single string
TimeSerial Converts a variant to a time
TimeValue Converts a variant to a time


Dates/Times
Date Returns the current date
Time Returns the current time
DateSerial Returns a date from its parts
DateValue Returns a date from its value
Day Returns day from a date
Month Returns month from a date
Weekday Returns weekday from a date


Dates/Times
Year Returns year from a date
Hour Returns hour from a time
Minute Returns minute from a time
Second Returns seconds from a time
Now Returns current date and time
TimeSerial Returns a time from its parts
TimeValue Returns a time from its value


Declarations
Dim Declares a variable
Private Declares script-level private variable
Public Declares public-level public variable
ReDim Reallocates an array
Function Declares a function
Sub Declares a subprocedure


Error Handling
On Error Enables error handling
Err Contains information about last error


Input/Output
InputBox Prompts the user for input
MsgBox Displays a message to the user


Math
Atn Returns the arctangent of a number
Cos Returns the cosine of a number
Sin Returns the sine of a number
Tan Returns the tangent of a number
Exp Returns the exponent of a number
Log Returns the logarithm of a number
Sqr Returns the square root of a number
Randomize Reseeds the randomizer
Rnd Returns a random number


Operators
+ Addition
- Subtraction
^ Exponentiation
Mod Modulus arithmetic
* Multiplication
/ Division
\ Integer Division
- Negation
& String concatenation
= Equality
<> Inequality
< Less Than
<= Less Than or Equal To
> Greater Than
>= Greater Than or Equal To
Is Compare expressions
And Compare expressions
Or Compares expressions
Xor Compares expressions
Eqv Compares expressions
Imp Compares expressions


Objects
CreateObject Creates reference to an OLE object
IsObject Returns True if object is valid


Options
Option Explicit Forces explicit variable declaration


Procedures
Call Invokes a subprocedure
Function Declares a function
Sub Declares a subprocedure


Strings
Asc Returns ASCII code of a character
AscB Returns ASCII code of a character
AscW Returns ASCII code of a character
Chr Returns character from an ASCII code
ChrB Returns character from an ASCII code
ChrW Returns character from an ASCII code
Instr Returns index of a string in another
InStrB Returns index of a string in another
Len Returns the length of a string
LenB Returns the length of a string
Lcase Converts a string to lowercase
Ucase Converts a string to uppercase
Left Returns the left portion of a string
LeftB Returns the left portion of a string
Mid Returns the mid portion of a string
MidB Returns the mid portion of a string
Right Returns the right portion of a string
RightB Returns the right portion of a string
Space Pads a string with spaces
StrComp Compares two strings
String Pads a string with a character
Ltrim Removes leading spaces from a string
Rtrim Removes trailing spaces from a string
Trim Removes leading and trailing spaces


Variants
IsArray Returns True if variable is an array
IsDate Returns True if variable is an date
IsEmpty Returns True if variable is empty
IsNull Returns True if variable is null
IsNumeric Returns True if variable is a number
IsObject Returns True if variable is an object
VarType Indicates a variable’s type

Sponsors

Fire up your website with CGI from ChilliScripts!

Submit your site today

Search Hundreds of Auction Sites!

Join Top50.to for FREE cash and promotion!