Allow certain users to edit certain rows?

  • Thread starter Thread starter hay7777
  • Start date Start date
H

hay7777

Hi Geof,

Actually, my question was how to create different logins for differen
people - they won't access it concurrently.

Is there a built-in way, or do I have to pop up a form to ask for it?

Thanks!

Davi
 
David,
If you're on a network and if all your users have network
ids then this should work:
'Goes at the top of the module.
Declare Function GetUserName Lib "advapi32.dll"
Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As
Long) As Long

Then get the id with:

Public Function GetCurrentUserName() As String

Dim lpBuff As String * 25
Dim ret As Long, Username As String

On Error GoTo Err_GetCurrentUserName

ret = GetUserName(lpBuff, 25)
'Username is global in scope.
Username = Left(lpBuff, InStr(lpBuff, Chr(0)) - 1)
GetCurrentUserName = Username & ""

Exit_GetCurrentUserName:
Exit Function

Err_GetCurrentUserName:
MsgBox Err.Description
Resume Exit_GetCurrentUserName
End Function

Call GetCurrentUserName in the Workbook_Open event. Match
the name up to some hidden list. There's no prompting to
this call. No password either, though. If you want to get
that fancy and professional-looking, then yes, use a form.

If you're not on a network, make a logon form and match to
your hidden list.

The API call just saves the user from entering an id.
Geof.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top