View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default Environ("username")

So you are talking about Active Directory ?

You example ("User1""User2") give the correct result on W2K, local account.

Could not locate the server in the link you provided, so no idea that
context.

NickHK

"riso" wrote in message
s.com...
I forgot .....

The same behaviour you can observe if you create an account as a XP
windows administrator with the name 'User1' and later rename that
account to User2 (via standart tools of XP windows administrator).

Environ("username") always returns User1 not User2.

I have seen a discusion similar to this one about .net
System.Environment.UserName (http://www.mcse.ms/message1250010.html).

The solution was to check the other properties of AD e.g. displayname,
CN, SN, givenName, userPrincipalName (sAMAccountName is the attribute
in AD that is the "username" used for logins
and such)

But I do not know how to utilise that solution in excel VBA.

riso

On Mar 6, 10:22 pm, "Bob Phillips" wrote:
Have you logged off of those machines and logged back on since?

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my

addy)

"riso" wrote in message

ups.com...



Hi folks,


An IT administrator 'created' 10 PC with windows XP with 2 users,
namely "administrator" and "weakuser", with an imagedisc. Later
administrator logged in to every computer and changed the account name
of the user from 'weakuser' to the real name of a person who uses that
computer (e.g. Smith, Shepard, etc).


The interesting thing is that Environ("username") on every PC returns
'weakuser', not the real name. Is it possible to find the login (Smith
or Shepard or etc.) in VBA?


thanks- Hide quoted text -


- Show quoted text -