Ayuda de Collabora Office 24.04
Defines one or more identifiers as constants.
Una constante es una variable que ayuda a mejorar la comprensibilidad de un programa. Las constantes no se definen como un tipo de variable específico, sino como sustitutivos en el código. Puede definir las constantes solamente una vez y no es posible modificarlas.
[Global|Private|Public] Const name = expression[, ...]
name: Any identifier that follows the standard variable naming conventions.
expression: Any literal expression.
The data type must be omitted. When a library gets loaded in memory, Collabora Office Basic converts the program code internally so that each time a constant is used, the defined expression replaces it.
By default constants are defined as private in modules and routines. Constants can be made public or global in order to be used from all modules, from all Basic libraries.
Global, Private and Public specifiers can only be used for module constants.
Const EARTH = "♁" ' module scope
Private Const MOON = "☾" ' module scope
Public Const VENUS="♀", MARS="♂" ' general scope
Global Const SUN = "☉", STAR = "☆" ' general scope
Sub ExampleConst
Const SUN = 3 * 1.456 / 56 ' SUN is local
MsgBox SUN,, MOON ' SUN global constant is unchanged
Const Pgm = "Program", Var = 1.00
MsgBox Pgm & " " & Var, , VENUS &" and "& MARS
End Sub