Siebel VB Language Reference > VB Language Reference >
Environ Function
This standard VB function returns the string setting for a keyword in the operating system's environment table. Syntax A
Environ[$](environment-string) Syntax B
Environ[$](numeric_expression)
|
|
environment-string |
The name of a keyword in the operating system |
numeric_expression |
An integer for the position of the string in the environment table (1st, 2nd, 3rd, and so on) |
Returns
The string value assigned to an environment variable. Usage
If you use the environment-string argument, enter it in uppercase, or Environ returns a null string (""). The return value for Syntax A is the string associated with the keyword requested. If you use the numeric_expression argument, the numeric expression is rounded to a whole number, if necessary. The return value for Syntax B is a string in the form KEYWORD=value. Environ returns a null string if the specified argument cannot be found. The dollar sign ($) in the function name is optional. If it is included, the return type is string. Otherwise the function returns a variant of vartype 8 (string). Example
This example lists the strings from the operating system environment table. Sub Button_Click Dim str1(100) Dim msgtext Dim count, x Dim newline newline = Chr(10) x = 1 str1(x) = Environ(x) Do While Environ(x) <> "" str1(x) = Environ(x) x = x + 1 str1(x) = Environ(x) Loop msgtext = "The Environment Strings are:" & newline & newline count = x For x = 1 to count msgtext = msgtext & str1(x) & newline Next x End Sub
|