Returns a string associated with an operating system environment variable.
Environ ( name | number)
Name - (Input, expression, Required)
Specifies the name of the environment variable to find. If the environment variable exists, its value (the string after the equal sign) is returned. If it does not exist, an empty string is returned.
Number - (Input, expression, Required)
If a number is given instead of a string, then the number is treated as the index of the environment variable to return (i.e. 1 returns the first environment variable, 2 returns the 2nd, etc.). In this case, the corresponding environment string (include the name and equals sign is returned). If the number is less than or equal to zero, then Error is returned. If the number is greater than the total number of environment strings, then an empty string is returned.
The environment variables value (if a string name is passed) or the complete environments string if a numeric index is specified.
The Name parameter is case sensitive, therefore the string entered must be exactly the same as the system variable for the function to return the correct value.
Environ (1) |
Might return “C:\WINDOWS\COMMAND.COM” |
Environ ("TEMP") |
Might return “C:\WINDOWS\TEMP” |
Environ (Null) |
Returns Error |
Environ (Error) |
ReturnsError |
Functions are specifically for use in the Macro Editor. Refer to Microsoft's official VB and JScript documentation for scripting equivalents.
Functions | IsAppRunning function | QBColor function | RGB function | Shell function
© 2004-2021 looksoftware. All rights reserved.