Environ

Return the value of an operating system environment variable.

Syntax
      Environ({envstring | number})

Key
   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 may 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.

Example

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

Related:

Environment Variables


© Copyright SS64.com 1999-2014
Some rights reserved