I am looking for so good information or code examples of the environ function for vba to grab the username on the current system.
+7
A:
Environ() gets you the value of any environment variable. These can be found by doing the following command in the Command Prompt:
set
If you wanted to get the username, you would do:
Environ("username")
If you wanted to get the fully qualified name, you would do:
Environ("userdomain") & "\" & Environ("username")
Eric
2009-06-01 14:55:44
that was exactly what I was looking for, just a little help getting started, thank you.
gary A.K.A. G4
2009-06-01 14:58:47
Fantastic, glad I could help!
Eric
2009-06-01 15:10:32
Don't forget that Environ is one of the functions blocked in Sandbox mode: http://office.microsoft.com/en-us/access/HP010447361033.aspx
Remou
2009-06-01 16:01:51