Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Password that user can manage

Status
Not open for further replies.

cll

Electrical
Jun 11, 2002
22
DK
Hi all
I have a workbook (Excel2002) with an "entrance userform" where users fill in name (pre-defined) and password (pre-defined). The code opens then the workbook accordingly (some sheets hidden, some protected and so on)
Can anyone show me how the user can manage their own password, or give links to articles that covers the password subject?

Regards
Claus
 
Replies continue below

Recommended for you

I hope this is not too late for you. Do you mean something like this?


If you want a macro which changes the password to a new one supplied by the user. Just record a quick macro of the operation, then view the code generated automatically and you should be able to work out what to do.

I hope this helps.
 
Hey!!

Thanks for replying. The first I've got (have asked in several forums).
The link desribes the "normal" way of protecting cells, sheets and workbook.
What I want is a more dedicated "passwording" (which I have made as described), with possibility for the users to change password (which I have not made yet).
I think I have to save the passwords in a (hidden) worksheet, and make changes from the entrance userform by code.

But anyway: Thanks Grafton54!

Regards
Claus
 
Claus,

I am not exactly sure what you mean by your dedicated method.

Can't you simply have a macro which pops up a dialogue box prompting the user to enter a password, then when the user clicks OK, automatically change the password settings of the workbook? You can set up a button or menu option for this macro.

When the workbook is closed and reopened, Excel will automatically prompt for the password anyway.
 
OK, maybe I'm not very good to explain the matter.

What I have made is, that when the workbook is opened, the user is asked (in a userform) for username and password.

When User1 enter Password1 the workbook opens in one way.
When User2 enter Password2 the workbook opens anotherway.
When User3 enter Password3 the workbook opens a third way.
Etc, etc.

If user enter wrong password the workbook don't open.

This is controlled from vba with the open event, not from Excel built-in protection.

What I haven't made but want to, is to let ie User1 change Password1 to OwnPassword1 (by typing in old password and new maybe two times). The code have to record the change so that User1 now is allowed to open the workbook entering OwnPassword1. This is quite normal way of doing it on the web for user restrictions.

Hope this clarify's....

Regards
Claus
 
Claus,

Thank you for your reply. I can understand your requirements now. Unfortunately I am not an expert in the subject, so do not take what I say as gospel.

With the default password protection functionality of Excel, you will be prompted to enter the password when opening the document (if you have one set up). For your requirements, you probably cannot use the default password protection functionality as it only supports one password.

As you say, it is not possible to change your macro by user input! I guess you can store your passwords in a hidden sheet. Make all your worksheets hidden and unhide them when the user types in the correct password.

The trouble is if you do not password protect the workbook the Excel way, your workbook will not be protected and anybody can just drag it to Notepad and read the contents of the cells. Even if you password protect the workbook, then once the users log in to open the workbook, they can use Tools->Macro->Macros and see what tricks you are up to anyway.

From what you describe, you want different users to have different levels of access to your data. This is a classical scenario that calls for a database solution. Considering using a database (e.g. MySQL server and PHP pages) for your data.

I have never used Excel to support multiple levels of security. Why bother when there is a viable alternative so readily available?
 
You're right! I must give the database solution a closer look.
Thanks a lot for your input!

Regards Claus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top