Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is there a way I can determine the windows USERID of the current user. I
would like to make some functionality available to some, but not all users? Thanks.. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
UName = Environ("Username")
demo'd from the immediate window: ? environ("username") ogilvytw -- Regards, Tom Ogilvy "Marvin" wrote: Is there a way I can determine the windows USERID of the current user. I would like to make some functionality available to some, but not all users? Thanks.. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks. This is getting closer, but it is not the login ID.
In my case, my Windows login ID is "wapnits", byt your technique returns "Marvin". Further, I have the ability to change the environment, but cannot change the userid. Thus, userid is more secure in preventing my user from doing things he shouldn't do. "Tom Ogilvy" wrote: UName = Environ("Username") demo'd from the immediate window: ? environ("username") ogilvytw -- Regards, Tom Ogilvy "Marvin" wrote: Is there a way I can determine the windows USERID of the current user. I would like to make some functionality available to some, but not all users? Thanks.. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
this give me the same, but maybe you will get different:
Private Declare Function apiGetUserName Lib "advapi32.dll" _ Alias "GetUserNameA" (ByVal lpBuffer As String, nsize As Long) As Long Sub GetUserNameTest() MsgBox fOSUserName End Sub 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 -- Regards, Tom Ogilvy "Marvin" wrote: Thanks. This is getting closer, but it is not the login ID. In my case, my Windows login ID is "wapnits", byt your technique returns "Marvin". Further, I have the ability to change the environment, but cannot change the userid. Thus, userid is more secure in preventing my user from doing things he shouldn't do. "Tom Ogilvy" wrote: UName = Environ("Username") demo'd from the immediate window: ? environ("username") ogilvytw -- Regards, Tom Ogilvy "Marvin" wrote: Is there a way I can determine the windows USERID of the current user. I would like to make some functionality available to some, but not all users? Thanks.. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Perfect. Thanks. What was the source of your information, and how can I
acquire it? "Tom Ogilvy" wrote: this give me the same, but maybe you will get different: Private Declare Function apiGetUserName Lib "advapi32.dll" _ Alias "GetUserNameA" (ByVal lpBuffer As String, nsize As Long) As Long Sub GetUserNameTest() MsgBox fOSUserName End Sub 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 -- Regards, Tom Ogilvy "Marvin" wrote: Thanks. This is getting closer, but it is not the login ID. In my case, my Windows login ID is "wapnits", byt your technique returns "Marvin". Further, I have the ability to change the environment, but cannot change the userid. Thus, userid is more secure in preventing my user from doing things he shouldn't do. "Tom Ogilvy" wrote: UName = Environ("Username") demo'd from the immediate window: ? environ("username") ogilvytw -- Regards, Tom Ogilvy "Marvin" wrote: Is there a way I can determine the windows USERID of the current user. I would like to make some functionality available to some, but not all users? Thanks.. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How can I get network userid in a cell in excel? | Excel Programming | |||
Log UserID | Excel Programming | |||
DSN UserId and Password Prompt | Excel Programming | |||
DSN UserId and Password Prompt | Excel Programming | |||
FileSystemObject CopyFile with UserID/Password | Excel Programming |