
Blackstone H. answered 09/10/19
Senior Database Developer using SQL, Visual Basic (VB)
Just like you use Dim keyword to "dimension" a variable, you use the Const keyword to declare a constant. But unlike Dim, with Const you just assign the value to the constant. From that point forward it can't be changed.
Public Sub PrintConstant()
Const MAX_RAM = 2048
Const TXT_MB = "Megabytes"
Const TXT_GB = "Gigabytes"
Debug.Print MAX_RAM & " " & TXT_MB
Debug.Print MAX_RAM & " " & TXT_GB
End Sub