Permissions to a macro

  • Thread starter Thread starter Neil Holden
  • Start date Start date
N

Neil Holden

I have a button in excel, i want only certain users to be able to press it,
is they any way i can add permissions to the button?

Neil.
 
Neil,

You could create a login userform and then use the username to determine
whether to enable or disable the command button. You could probably do the
same just using Windows username properties. I guess it depends on how large
your user base might be. I've used the login form method on several projects.

Ken
 
Neil,

You could do this but it's not secure. The variable S is a comma deleted
string of allowed users. If the active user isn't in the list then the sub
terminates

Sub Button1_Click()
S = "aaa,bbb,ccc"
v = Split(S, ",")
For x = 0 To UBound(v)
If Environ("username") = v(x) Then
allowed = True
Exit For
End If
Next
If Not allowed Then Exit Sub
MsgBox "OK"
'Your Code
End Sub

Mike
 

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

Similar Threads


Back
Top