Constants
- Last UpdatedOct 29, 2026
- 3 minute read
Color Constants
|
Constant |
Value |
Description |
|---|---|---|
|
vbBlack |
&h00 |
Black |
|
vbRed |
&hFF |
Red |
|
vbGreen |
&hFF00 |
Green |
|
vbYellow |
&hFFFF |
Yellow |
|
vbBlue |
&hFF0000 |
Blue |
|
vbMagenta |
&hFF00FF |
Magenta |
|
vbCyan |
&hFFFF00 |
Cyan |
|
vbWhite |
&hFFFFFF |
White |
Comparison Constants
|
Constant |
Value |
Description |
|---|---|---|
|
vbBinaryCompare |
0 |
Perform a binary comparison |
|
vbTextCompare |
1 |
Perform a textual comparison |
Date and Time Constants
|
Constant |
Value |
Description |
|---|---|---|
|
vbSunday |
1 |
Sunday |
|
vbMonday |
2 |
Monday |
|
vbTuesday |
3 |
Tuesday |
|
vbWednesday |
4 |
Wednesday |
|
vbThursday |
5 |
Thursday |
|
vbFriday |
6 |
Friday |
|
vbSaturday |
7 |
Saturday |
|
vbUseSystemDayOfWeek |
0 |
Use the day of the week specified in your system settings for the first day of the week. |
|
vbFirstJan1 |
1 |
Use the week in which January 1 occurs (default). |
|
vbFirstFourDays |
2 |
Use the first week that has at least four days in the new year. |
|
vbFirstFullWeek |
3 |
Use the first full week of the year. |
Date Format Constants
|
Constant |
Value |
Description |
|---|---|---|
|
vbGeneralDate |
0 |
Display a date and/or time. For real numbers, display a date and time. If there is no fractional part, display only a date. If there is no integer part, display time only. Date and time display is determined by your system settings. |
|
vbLongDate |
1 |
Display a date using the long date format specified in your computer's regional settings. |
|
vbShortDate |
2 |
Display a date using the short date format specified in your computer's regional settings. |
|
vbLongTime |
3 |
Display a time using the long time format specified in your computer's regional settings. |
|
vbShortTime |
4 |
Display a time using the short time format specified in your computer's regional settings. |
Miscellaneous Constants
|
Constant |
Value |
Description |
|---|---|---|
|
vbObjectError |
-2147221504 |
User-defined error numbers should be greater than this value. |
Box Constants – Buttons and Icons
|
Constant |
Value |
Description |
|---|---|---|
|
vbOKOnly |
0 |
Display OK button only. |
|
vbOKCancel |
1 |
Display OK and Cancel buttons. |
|
vbAbortRetryIgnore |
2 |
Display Abort, Retry, and Ignore buttons. |
|
vbYesNoCancel |
3 |
Display Yes, No, and Cancel buttons. |
|
vbYesNo |
4 |
Display Yes and No buttons. |
|
vbRetryCancel |
5 |
Display Retry and Cancel buttons. |
|
vbCritical |
16 |
Display Critical Message icon. |
|
vbQuestion |
32 |
Display Warning Query icon. |
|
vbExclamation |
48 |
Display Warning Message icon. |
|
vbInformation |
64 |
Display Information Message icon. |
|
vbDefaultButton1 |
0 |
First button is the default. |
|
vbDefaultButton2 |
256 |
Second button is the default. |
|
vbDefaultButton3 |
512 |
Third button is the default. |
|
vbDefaultButton4 |
768 |
Fourth button is the default. |
|
vbApplicationModal |
0 |
Application modal. The user must respond to the message box before continuing work in the current application. |
|
vbSystemModal |
4096 |
System modal. On Win16 systems, all programs are suspended until the user responds to the message box. On Win32 systems, this constant provides a program modal message box that always remains on top of any other programs you may have running. |
Box Constants – Selected Button
|
Constant |
Value |
Description |
|---|---|---|
|
vbOK |
1 |
OK button was clicked. |
|
vbCancel |
2 |
Cancel button was clicked. |
|
vbAbort |
3 |
Abort button was clicked. |
|
vbRetry |
4 |
Retry button was clicked. |
|
vbIgnore |
5 |
Ignore button was clicked. |
|
vbYes |
6 |
Yes button was clicked. |
|
vbNo |
7 |
No button was clicked. |
String Constants
|
Constant |
Value |
Description |
|---|---|---|
|
vbCr |
Chr(13) |
Carriage return |
|
VbCrLf |
Chr(13) & Chr(10) |
Carriage return…linefeed combination |
|
vbFormFeed |
Chr(12) |
Form feed; not useful in Microsoft Windows |
|
vbLf |
Chr(10) |
Line feed |
|
vbNewLine |
Chr(13) & Chr(10) or Chr(10) |
Platform-specific newline character; whatever is appropriate for the platform |
|
vbNullChar |
Chr(0) |
Character having the value 0 |
|
vbNullString |
String having value 0 |
Not the same as a zero-length string (""); used for calling external procedures |
|
vbTab |
Chr(9) |
Horizontal tab |
|
vbVerticalTab |
Chr(11) |
Vertical tab; not useful in Microsoft Windows |
Tristate Constants
|
Constant |
Value |
Description |
|---|---|---|
|
vbUseDefault |
-2 |
Use default from computer's regional settings. |
|
vbTrue |
-1 |
TRUE |
|
vbFalse |
0 |
FALSE |
VarType Constants
|
Constant |
Value |
Description |
|---|---|---|
|
vbEmpty |
0 |
Uninitialized (default) |
|
vbNull |
1 |
Contains no valid data |
|
vbInteger |
2 |
Integer subtype |
|
vbLong |
3 |
Long subtype |
|
vbSingle |
4 |
Single subtype |
|
vbDouble |
5 |
Double subtype |
|
vbCurrency |
6 |
Currency subtype |
|
vbDate |
7 |
Date subtype |
|
vbString |
8 |
String subtype |
|
vbObject |
9 |
Object |
|
vbError |
10 |
Error subtype |
|
vbBoolean |
11 |
Boolean subtype |
|
vbVariant |
12 |
Variant (used only for arrays of variants) |
|
vbDataObject |
13 |
Data access object |
|
vbDecimal |
14 |
Decimal subtype |
|
vbByte |
17 |
Byte subtype |
|
vbArray |
8192 |
Array |