View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Peter T[_7_] Peter T[_7_] is offline
external usenet poster
 
Posts: 162
Default Weird Behaviour of Compiler Directives?


"Spiggy Topes" wrote in message

Everything Gary said but just to add, conditional constants (which you use
within a #If) should be defined in "Conditional compiler constants" which
you'll see if you right click the project name and click properties.

Where I said paste LOCATION = 1, and adapt your #If to simply

#If LOCATION Then
Const GOTIT = "Home"
#Else
Const GOTIT = "Away"
#End If

If LOCATION=1 GOTIT will return Home, if =0 or it doesn't exist "AWAY". For
your purposes the only reason to use this approach is it will always work if
the project is reset for some reason and any global variables get destroyed,
typically for use when debugging projects. Otherwise easier to use one of
the approaches Gary suggested.

Regards,
Peter T