What does # mean in front of IF statements
That means conditional statements.
In VBA, when the code is compiled, the #If statement is checked , and if
true (a windows system in the example) it compiles one command, if not, it
compiles the other.
It is a very useful method to allow your code to be platform, or version,
independent.
--
HTH
Bob Phillips
(replace xxxx in the email address with gmail if mailing direct)
wrote in message
ups.com...
I have a couple macros that run on PC and Macs. I learned that I have
to put a "#" in front of the file access code to make the macro utilize
the appropriate OS commands:
Example:
#If Win32 Then
LoadFileName = Application.GetOpenFilename(FileFilter)
#ElseIf Mac Then
LoadFileName = Application.GetOpenFilename()
#End If
Can someone explain why the # is necessary and what it means?
Thanks
|