Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
VBA function Environ(29) returns the logged in user's name.
Perhaps it does on your machine, but that is by no means a valid assumption for any other machine. On this box, 29 is the processor level value. Never use a numeric value to get an environment variable's value. Use the name: Debug.Print Environ("username") Note also that there is a difference when getting an environment variable's value by name or by number. When Environ is used with the name, as in Debug.Print Environ("username") it returns only the value assigned to the variable. When retrieved by number, as in Debug.Print Environ(29) Both the name and the value are returned, separated by an = character. E.g, Debug.Print Environ(29) displays "PROCESSOR_LEVEL=6" rather than just "6". Cordially, Chip Pearson Microsoft MVP 1998 - 2010 Pearson Software Consulting, LLC www.cpearson.com [email on web site] On Mon, 7 Dec 2009 04:45:01 -0800, Stein wrote: VBA function Environ(29) returns the logged in user's name. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
File Path | Excel Worksheet Functions | |||
File Path | Excel Worksheet Functions | |||
Variabilize File Path or File Name in SumProduct (and Vlookup too) | Excel Worksheet Functions | |||
Formula too long - new file path is shorter than old file path - Excel 2003 | Excel Worksheet Functions | |||
Excel updating from XML file - file path specific? | Excel Discussion (Misc queries) |