I'd like to set the value of a const variable conditionally at Compile time. I thought i could achieve this using vba compiler directives #If #Else etc. as below, but have been unsuccessful so far:
#If Environ("username") = "myusername" Then
Public Const ErrorHandling As Boolean = False
#Else
Public Const ErrorHandling As Boolean = True
#End If
When i run this code, im getting an error that the Environ variable is undefined.
Would something like this even be possible? Or do i just have to make my 'ErrorHandling' variable Public (not Const), and set it at the initialisation of my code?
Thanks in advance,
cjk