Global Varable vs Global Constant
Posted on 2013-06-14
Please help me to create a global variable so I can use "YearRef" throughout all functions and sub routines.
I am using global constants throughout my code:
EXAMPLE of global constant:
Global Const InvNo As String = "R8570584"
I know I cannot do the same with a variable like
Global YearRef As String = Format(Now(), "yyyy")
Global YearRef As Variant = Format(Now(), "yyyy")
I have tried creating a Public sub function this but it doesn't work.
Public Sub Init_Globals()
' Access global variable initialization
Dim YearRef As String
YearRef = Format(Now(), "yyyy")