Sideway
output.to from Sideway





Draft for Information Only

VBScript Constants and Literals

Besides reserved keywords, VBScript also includes a number of predefined intrinsic constants that can be used in VBScript scripting to improve the readability of scripts by replacing  the numeric equivalents to a meaningful constants.

Predefined Contstants

Some common words are used as predefined constants for different applications and purposes.

Color Constants

Since these predefined constants are built into VBScript, these constants can be used anywhere in the code to represent the values shown for each.

ConstantValueDecimal ValueDescriptionvbBlack&h000Color BlackvbRed&hFF255Color RedvbGreen&hFF0065280Color GreenvbYellow&hFFFF65535Color YellowvbBlue&hFF000016711680Color BluevbMagenta&hFF00FF16711935Color MagentavbCyan&hFFFF0016776960Color CyanvbWhite&hFFFFFF16777215Color White

Comparison Constants

Since these predefined constants are built into VBScript, these constants can be used anywhere in the code to represent the values shown for each.

ConstantValueDescriptionvbBinaryCompare0Perform a BinaryComparevbTextCompare1Perform a TextCompare

Date and Time Constants

Since these predefined constants are built into VBScript, these constants can be used anywhere in the code to represent the values shown for each.

ConstantValueDescriptionvbSunday1SundayvbMonday2MondayvbTuesday3 TuesdayvbWednesday4WednesdayvbThursday5ThursdayvbFriday6FridayvbSaturday7SaturdayvbUseSystemDayOfWeek0Use the day of the week specified in local system settings for the first day of the week.vbFirstJan11Use the week in which January 1 occurs.vbFirstFourDays2Use the first week that has at least four days in the new year.vbFirstFullWeek3Use the first full week of the year.vbUseSystem0Use National Language Support (NLS) API setting.

Date Format Constants

Since these predefined constants are built into VBScript, these constants can be used anywhere in the code to represent the values shown for each.

ConstantValueDescriptionvbGeneralDate0Display a date and/or time using the GeneralDate format specified in local computer's system settings. 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.vbLongDate1Display a date using the LongDate format specified in local computer's regional settings.vbShortDate2Display a date using the ShortDate format specified in local computer's regional settings.vbLongTime3Display a date using the LongTime format specified in local computer's regional settings.vbShortTime4Display a date using the ShortTime format specified in local computer's regional settings.

Miscellaneous Constants

Since these predefined constants are built into VBScript, these constants can be used anywhere in the code to represent the values shown for each.

ConstantValueDescriptionvbObjectError-2147221504User-defined error numbers should be greater than this value, for example, Err.Raise Number = vbObjectError + 1000

MsgBox Constants

The following constants are used with the MsgBox function to identify what buttons and icons appear on a message box and which button is the default. In addition, the modality of the MsgBox can be specified. Since these predefined constants are built into VBScript, these constants can be used anywhere in the code to represent the values shown for each.

ConstantValueDescriptionvbOKOnly0Display OK button only.vbOKCancel1Display OK and Cancel buttons.vbAbortRetryIgnore2Display Abort, Retry, and Ignore buttons.vbYesNoCancel3Display Yes, No, and Cancel buttons.vbYesNo4Display Yes and No buttons.vbRetryCancel5Display Retry and Cancel buttons.vbCritical16Display Critical Message icon.vbQuestion32Display Warning Query icon.vbExclamation48Display Warning Message icon.vbInformation64Display Information Message icon.vbDefaultButton10First button is the default.vbDefaultButton2256Second button is the default.vbDefaultButton3512Third button is the default.vbDefaultButton4768Fourth button is the default.vbApplicationModal0Application modal. The user must respond to the message box before continuing work in the current application.vbSystemModal4096System modal. On Win16 systems, all applications are suspended until the user responds to the message box. On Win32 systems, this constant provides an application modal message box that always remains on top of any other programs you may have running.

The following constants are used with the MsgBox function to identify which button a user has selected. These constants are only available when the application project has an explicit reference to the appropriate type library containing these built-in constant definitions. For VBScript, these constants must be explicitly declared in the application code.

ConstantValueDescriptionvbOK1OK button was clicked.vbCancel2Cancel button was clicked.vbAbort3Abort button was clicked.vbRetry4Retry button was clicked.vbIgnore5Ignore button was clicked.vbYes6Yes button was clicked.vbNo7No button was clicked.

String Constants

Since these predefined constants are built into VBScript, these constants can be used anywhere in the code to represent the values shown for each.

ConstantValueDescriptionvbCrChr(13)Carriage return.VbCrLfChr(13) & Chr(10)Carriage return–linefeed combination.vbFormFeedChr(12)Form feed; not useful in Microsoft Windows.vbLfChr(10)Line feed.vbNewLineChr(13) & Chr(10) or Chr(10)Platform-specific newline character; whatever is appropriate for the platform.vbNullCharChr(0)Character having the value 0.vbNullStringString having value 0Not the same as a zero-length string (""); used for calling external procedures.vbTabChr(9)Horizontal tab.vbVerticalTabChr(11)Vertical tab; not useful in Microsoft Windows.

Tristate Constants

Since these predefined constants are built into VBScript, these constants can be used anywhere in the code to represent the values shown for each.

ConstantValueDescriptionvbUseDefault-2UseDefault from computer's regional settingsvbTrue-1TruevbFalse0False

VarType Constants

These constants are only available when the application project has an explicit reference to the appropriate type library containing these built-in constant definitions. For VBScript, these constants must be explicitly declared in the application code.

ConstantValueDescriptionvbEmpty0Uninitialized (default)vbNull1Contains no valid datavbInteger2Integer subtypevbLong3Long subtypevbSingle4Single subtypevbDouble5Double subtypevbCurrency6Currency subtypevbDate7Date subtypevbString8String subtypevbObject9ObjectvbError10Error subtypevbBoolean11Boolean subtypevbVariant12Variant (used only for arrays of variants)vbDataObject13Data access objectvbDecimal14Decimal subtypevbByte17Byte subtypevbArray8192Array

Predefined Literals

Some common words are used as predefined literals with specific meanings. Since these predefined literals are built into VBScript, these constants can be used anywhere in the code to represent the values shown for each.

ConstantValueDescriptionTrueEval(True)=True
IsNumeric=True
A Boolean True
FalseEval(False)=False
IsNumeric=True
A Boolean False
NullIsNull=True
IsEmpty=False
IsObject=False
A variable contains no valid data
EmptyIsNull=False
IsEmpty=True
IsObject=False
An uninitialized variable
NothingIsNull=False
IsEmpty=False
IsObject=True
An object reference that refers to no object.

©sideway

ID: 180400013 Last Updated: 2018/4/13 Revision:

IMAGE

Home (1)

Business

Management

HBR (3)

Information

Recreation

Hobbies (7)

Culture

Chinese (1097)

English (330)

Reference (60)

Computer

Hardware (148)

Software

Application (187)

Digitization (24)

Numeric (19)

Programming

Web (519)new

HTML

Knowledge Base

Common Color (1)

Html Entity (Unicode) (1)

Html 401 Special (1)

OS (364)

MS Windows

Windows10 (1)

DeskTop (5)

Knowledge

Mathematics

Formulas (7)

Number Theory (54)

Algebra (14)

Trigonometry (18)

Geometry (18)

Calculus (66)

Engineering

Tables (8)

Mechanical

Control

Process Control (1)

Mechanics (1)

Rigid Bodies

Statics & Dynamics (128)

Fluid (5)

Fluid Kinematics (5)

Acoustics (19)

FiniteElement (2)

Biology (1)

Geography (1)


facebook
Latest Updated Links

Copyright © 2000-2018 Sideway . All rights reserved Disclaimersfacebook last modified on 08 Mar 2018