List of VBScript constants
These constant values are provided with VBScript to specify arguments for built-in functions and can be typed in place of their value.
Contents
Color constants
These specify a color (Long value) you can pass to functions that want colors, such as AddChat(). The hexadecimal representation of the colors are also listed here.
vbBlack
(0 or &H000000) - BlackvbRed
(255 or &H0000FF) - RedvbYellow
(65535 or &H00FFFF) - YellowvbGreen
(65280 or &H00FF00) - Lime greenvbCyan
(16776960 or &HFFFF00) - CyanvbBlue
(16711680 or &HFF0000) - BluevbMagenta
(16711935 or &HFF00FF) - MagentavbWhite
(16777215 or &HFFFFFF) - White
Compare mode settings
These specify how strings should be compared.
vbBinaryCompare
(0) - Perform a binary comparison: this is a case-sensitive comparisonvbTextCompare
(1) - Perform a textual comparison: this is a case-insensitive comparisonvbDatabaseCompare
(2) - Perform a database comparison: uses locale settings for special characters in the comparison (this setting is often unused)
Date format settings
These specify which format to display a date in.
vbGeneralDate
(0) - Display a date in format mm/dd/yy. If the date value contains a time, it will also be displayed.vbLongDate
(1) - Display a date using the long date format: weekday, month day, yearvbShortDate
(2) - Display a date using the short date format: like the default (mm/dd/yy)vbLongTime
(3) - Display a time using the time format: hh:mm:ss PM/AMvbShortTime
(4) - Display a time using the 24-hour format: hh:mm
First day of week settings
These specify which weekday is considered the first day of a week.
vbUseSystemDayOfWeek
(0) - Use National Language Support (NLS) API settingvbSunday
(1) - SundayvbMonday
(2) - MondayvbTuesday
(3) - TuesdayvbWednesday
(4) - WednesdayvbThursday
(5) - ThursdayvbFriday
(6) - FridayvbSaturday
(7) - Saturday
First week of year settings
These specify which week is considered the first week of a year.
vbUseSystem
(0) - Use National Language Support (NLS) API settingvbFirstJan1
(1) - Start with the week in which January 1 occursvbFirstFourDays
(2) - Start with the week that has at least four days in the new yearvbFirstFullWeek
(3) - Start with the first full week of the new year
Message box results
These specify the result of a message box, or which button the user clicked.
vbOK
(1) - OK was clickedvbCancel
(2) - Cancel was clickedvbAbort
(3) - Abort was clickedvbRetry
(4) - Retry was clickedvbIgnore
(5) - Ignore was clickedvbYes
(6) - Yes was clickedvbNo
(7) - No was clicked
Message box settings
These specify binary flags for four different settings for a message box. Using the bitwise Or
operator, one can combine these flags to create a message box with the desired settings.
The hexadecimal representation of the numbers are also provided to show how each setting does not conflict with others if they are combined correctly.
The first setting specifies which buttons to show:
vbOKOnly
(0 or &H0000) - OK button onlyvbOKCancel
(1 or &H0001) - OK and Cancel buttonsvbAbortRetryIgnore
(2 or &H0002) - Abort, Retry, and Ignore buttonsvbYesNoCancel
(3 or &H0003) - Yes, No, and Cancel buttonsvbYesNo
(4 or &H0004) - Yes and No buttonsvbRetryCancel
(5 or &H0005) - Retry and Cancel buttons
The second setting specifies which icon to show:
vbCritical
(16 or &H0010) - Critical Message iconvbQuestion
(32 or &H0020) - Warning Query iconvbExclamation
(48 or &H0030) - Warning Message iconvbInformation
(64 or &H0040) - Information Message icon
The third setting specifies which button is the default button:
vbDefaultButton1
(0 or &H0000) - First button is defaultvbDefaultButton2
(256 or &H0100) - Second button is defaultvbDefaultButton3
(512 or &H0200) - Third button is defaultvbDefaultButton4
(768 or &H0300) - Fourth button is default
The fourth setting specifies window modality:
vbApplicationModal
(0 or &H0000) - Application modal (the current application will not work until the user responds to the message box)vbSystemModal
(4096 or &H1000) - System modal (all applications wont work until the user responds to the message box)
Additional settings specify:
vbMsgBoxHelpButton
(16384 or &H4000) - Show help buttonvbMsgBoxSetForeground
(65536 or &H10000) - ???vbMsgBoxRight
(524288 or &H40000) - Align text to the rightvbMsgBoxRtlReading
(1048576 or &H100000) - RTL mode window (window control buttons and user buttons on the left and left-aligned)
Combine them with Or
(not +
) to make the flag value to pass to the message box function.
String constants
The following built-in constants provide string values.
vbNullString
- an empty string. This is the same as passing""
, but is preferred for efficiency.vbNullChar
- the null character (also the result ofChr(0)
).vbBack
- the "backspace" character (result ofChr(8)
).vbTab
- the tab character (result ofChr(9)
).vbLf
- the "line feed" character (result ofChr(10)
).vbVerticalTab
- the "vertical tab" character (result ofChr(11)
).vbFormFeed
- the "form feed" character (result ofChr(12)
).vbCr
- the "carriage return" character (result ofChr(13)
).vbNewLine
- the new line string for the current system. On Windows systems (almost all VBScript systems), this is two characters: "carriage return" followed by "line feed".vbCrLf
- the Windows new line string (result ofvbCr & vbLf
).
Variable types
These specify variant type of VBScript variables.
vbEmpty
(0) - Indicates Empty (uninitialized)vbNull
(1) - Indicates Null (no valid data)vbInteger
(2) - Indicates an integer (whole number)vbLong
(3) - Indicates a long integervbSingle
(4) - Indicates a single-precision floating-point numbervbDouble
(5) - Indicates a double-precision floating-point number (decimal number)vbCurrency
(6) - Indicates a currencyvbDate
(7) - Indicates a datevbString
(8) - Indicates a stringvbObject
(9) - Indicates an automation objectvbError
(10) - Indicates an errorvbBoolean
(11) - Indicates a Boolean (True or False)vbVariant
(12) - Indicates a variantvbDataObject
(13) - Indicates a data-access objectvbDecimal
(14) - Indicates a decimal valuevbByte
(17) - Indicates a bytevbArray
(8192) - Indicates an array: this is occasionally seen combined (using bitwiseOr
) with another value to specify the type of values in the array
Other constant values
These constant values are also provided for various type defaults.
Empty
- an uninitialized valueNull
- a value with no valid dataNothing
- a null objectTrue
- a positive Boolean valueFalse
- a negative Boolean value
And other miscellaneous constants.
vbObjectError
- the number -2147221504 (&H80040000)