Return the value of an Operating System environment variable.

      Environ({envstring | number})

   envstring   The name of an environment variable.

   number      A number corresponding to the numeric order
               of the environment string in the environment-string table.

The Environ() function can be used in VBA or in an SQL query.

Relying on environment variables such as username and computername can be a security issue, it is easy for an end user to change these values at the command prompt, a more secure alternative is to use API calls: username and computername.


Dim strDemo as String
strDemo = Environ("Path")
MsgBox strDemo

“Begin at the beginning, the King said, very gravely, and go on till you come to the end: then stop” ~ Lewis Carroll


Environment Variables

Copyright © 1999-2024 SS64.com
Some rights reserved