Const Definition

Syntax

[ | Private | Public ] _
Const name[type] [As Type] = expr[, ...]

Group

Declaration

Description

Define name as the value of expr. The expr can refer to other constants or built-in functions. If the type of the constants is not specified, the type of expr is used. Constants defined outside a Sub, Function or Property block are available in the entire macro/module.

Private
is assumed if neither Private or Public is specified.

Note: Const statement in a Sub, Function or Property block may not use Private or Public.

Example

Sub Main
Const Pi = 4*Atn(1), e = Exp(1)
Debug
.Print Pi ' 3.14159265358979
Debug
.Print e ' 2.71828182845905
End
Sub