The information in this article applies to:
IMPORTANT: The CALL() and REGISTER() functions are provided for advanced users only. If you use these functions incorrectly you could accidentally cause errors in your system's operation. SUMMARYIt is possible to retrieve a set of characters from the MS-DOS environment string from Microsoft Excel if you are running under Microsoft Windows 3.0. This is done using the CALL and REGISTER functions. MORE INFORMATION
The DOS environment is an area of memory that MS-DOS sets aside to store a
series of ASCII strings. Each string in the environment is terminated by a
byte of zero. The final string is terminated by two bytes of zero.
NOTE: The CALL function can also be used on a standard worksheet in
Microsoft Excel version 3.0.
Using a return parameter of "D" in the REGISTER function tells Microsoft Excel to interpret the value returned from the DLL function call as a string with the first byte containing the number of bytes to follow in the string. In this case, the first byte in the string returned will be the first ASCII character in your environment string. If this character has a decimal value of N, the following N characters will be returned. ExampleIf the first string in your environment is "~USERNAME=BOB", cell A3 returns 126 characters of your environment string, starting with
where {null} indicates the zero byte terminating the string. This is
because the ASCII tilde character "~" has a decimal value of 126. You can
then search this string for particular environment variables.
REFERENCES
"Online Help," version 5.0 Additional query words: 2.1 2.10 3.0 3.00 4.0 4.00 5.0 5.00 environment variable
Keywords : |
Last Reviewed: July 23, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |