Defining Constants

Microsoft® Windows® 2000 Scripting Guide

Constants are defined in VBScript by using the Const statement followed by the name and value of the constant. When you define a constant, you must assign it a literal value; you cannot assign a value to a constant by using a variable, another constant, or a function. For example, the following code sample, which attempts to define a constant using the variable NumberOfDepartments, will generate an "Expected literal constant" error:

NumberOfDepartments = 20
Const NUMBER_OF_DEPARTMENTS = NumberOfDepartments

Instead, assign the constant the literal value 20: