A number of useful constants you can use in your code are built into VBScript. Constants provide a convenient way to use specific values without actually having to remember the value itself. Using constants also makes your code more maintainable should the value of any constant ever change. Because these constants are already defined in VBScript, you don't need to explicitly declare them in your code. Simply use them in place of the values they represent.
Here are the various categories of constants provided in VBScript and a brief description of each:
- Color Constants Defines eight basic colors that can be used in scripting.
- Comparison Constants Defines constants used to compare strings.
- Date and Time Constants Defines date and time constants used by various date and time functions.
- Date Format Constants Defines constants used to format dates and times.
- Miscellaneous Constants Defines constants that don't conveniently fit into any other category.
- MsgBox Constants Defines constants used in the MsgBox function to describe button visibility, labeling, behavior, and return values.
- String Constants Defines a variety of non-printable characters used in string manipulation.
- Tristate Constants Defines constants used with functions that format numbers.
- VarType Constants Defines the various Variant subtypes.