From: Dan on 7 Jun 2010 05:09 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
From: Bob Phillips on 7 Jun 2010 06:30 Works on my system. -- HTH Bob "Dan" <Dan(a)discussions.microsoft.com> wrote in message news:DD1B96B5-CA99-4373-A5E6-C64E85287506(a)microsoft.com... > 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 >
From: Dave Peterson on 7 Jun 2010 07:20 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
From: Dan on 7 Jun 2010 08:07 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 > . >
From: Dave Peterson on 7 Jun 2010 08:58 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
|
Pages: 1 Prev: Can I 'toggle' a toolbar button Next: MsgBox refer to seperate worksheet |