Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Environ("username") in 2007
debug.Print Environ("username") does work on 2003 but not on 2007?
I have read other posting with a similar question and it is written ther "problem is solved by changing the environmental variables" - how do you do that or any other suggestion? Many thanks, Dan |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Environ("username") in 2007
Works on my system.
-- HTH Bob "Dan" wrote in message ... debug.Print Environ("username") does work on 2003 but not on 2007? I have read other posting with a similar question and it is written ther "problem is solved by changing the environmental variables" - how do you do that or any other suggestion? Many thanks, Dan |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Environ("username") in 2007
My guess is that it's more related to the version of windows (not excel) that
you're running. You may want to share that to see if others running the same configuration will comment. Dan wrote: debug.Print Environ("username") does work on 2003 but not on 2007? I have read other posting with a similar question and it is written ther "problem is solved by changing the environmental variables" - how do you do that or any other suggestion? Many thanks, Dan -- Dave Peterson |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Environ("username") in 2007
The problem is on XP, but I tried on another XP I have and working fine on
it, so maybe my installation is wrong. "Dave Peterson" wrote: My guess is that it's more related to the version of windows (not excel) that you're running. You may want to share that to see if others running the same configuration will comment. Dan wrote: debug.Print Environ("username") does work on 2003 but not on 2007? I have read other posting with a similar question and it is written ther "problem is solved by changing the environmental variables" - how do you do that or any other suggestion? Many thanks, Dan -- Dave Peterson . |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Environ("username") in 2007
You could verify that the environment variable exists.
Windows start button|Run type: cmd and hit enter. Then type: Set and hit enter Scroll up/down looking for USERNAME. It works fine for me with WinXP Pro and xl2007. ======== But there are other ways to get the username, too: Option Explicit Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _ "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long Function fOSUserName() As String ' Returns the network login name Dim lngLen As Long, lngX As Long Dim strUserName As String strUserName = String$(254, 0) lngLen = 255 lngX = apiGetUserName(strUserName, lngLen) If lngX < 0 Then fOSUserName = Left$(strUserName, lngLen - 1) Else fOSUserName = "" End If End Function Sub testme() MsgBox fOSUserName 'to test to see if it worked. End Sub Dan wrote: The problem is on XP, but I tried on another XP I have and working fine on it, so maybe my installation is wrong. "Dave Peterson" wrote: My guess is that it's more related to the version of windows (not excel) that you're running. You may want to share that to see if others running the same configuration will comment. Dan wrote: debug.Print Environ("username") does work on 2003 but not on 2007? I have read other posting with a similar question and it is written ther "problem is solved by changing the environmental variables" - how do you do that or any other suggestion? Many thanks, Dan -- Dave Peterson . -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Environ("Username") with Windows7 64bit | Excel Programming | |||
Converting Environ("username") from 2003 to 2007 | Excel Programming | |||
Environ("USERNAME") | Excel Programming | |||
environ username vs. application username | Excel Programming | |||
Environ("username") | Excel Programming |