This is also sometimes referred to as just a constant.
To define or declare a symbolic constant use the keyword Const.
Note that string constants are enclosed in double quotes "string".
Const sFOLDERPATH As String = "C:\Temp\"
In this case every instance of the variable sFOLDERPATH is replaced with the string "C:\Temp\".
sFOLDERPATH is a constant since it never changes but it is not a literal constant since it is not used anywhere.
The advantage of using symbolic constants is that if you decide to change the value at a later date you only need to change the definition of the variable sFOLDERPATH rather than searching and replacing all occurrences of the old string.
© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext