Share via


VBScript Constants

 

A constant is a meaningful name that takes the place of a number or string and never changes. Visual Basic Scripting Edition (VBScript) defines a number of intrinsic constants. You can get information about these intrinsic constants from the VBScript Language Reference.

Creating Constants

You create user-defined constants in VBScript using the Const statement. Using the Const statement, you can create string or numeric constants with meaningful names and assign them literal values. For example:

Const MyString = "This is my string."
Const MyAge = 49

Note that the string literal is enclosed in quotation marks (" "). Quotation marks can be used to differentiate string values from numeric values. You represent Date literals and time literals by enclosing them in number signs (#). For example:

Const CutoffDate = #06/18/2008#
Const CutoffTime = #3:36:00 PM#

Change History

Date

History

Reason

September 2009

Added a time literal example.

Information enhancement.