Password protected userform

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I password protect a userform.So that only key people can open a
userform. Also is it possible to change the password in the future?
 
You can change the procedure that shows the userform.

Dim myPWD as string
dim UserPWD as string
mypwd = "hi"
userpwd = inputbox(Prompt:="Password")
if userpwd <> mypwd then
msgbox "Not authorized"
exit sub '???
end if
'keep going

You could change the password in the code and redistribute the workbook.

You could store the password in a text file that everyone has access to--but
encrypt that password and then read the string from that text file and translate
it to what you need.
 
Thanks Dave. It works well.
I was thinking of storing the password in a worksheet(which is hiden) and
protecting the project. How would I refir the password to a cell in a
worksheet, say sheet3.
 
if userpwd <> thisworkbook.worksheets("Sheet13").range("a1").value then

If Sheet13 is the name you see on the worksheet tab when that worksheet is
visible.
Thanks Dave. It works well.
I was thinking of storing the password in a worksheet(which is hiden) and
protecting the project. How would I refir the password to a cell in a
worksheet, say sheet3.
 
Back
Top