Clive,
You could use a registry key with a default value and store an encrypted
string. That removes any need to edit your code.
e.g.
'to retrieve the saved password
strPass = GetSetting("MyApp","Settings","Authentication","jj sudyydhsk")
'decrypt the password somehow
when the user changes password
strNewPass = 'whatever the user entered
'encrypt the password somehow
SaveSetting "MyApp","Settings","Authentication",strNewPass
Robin Hammond
www.enhanceddatasystems.com
"ccarmock" wrote in
message ...
I have a sheet that makes use of security a fair bit. I need the
ability for a user to be able to change the password. I currently
store this in a global variable that is set in Auto_Open()
This same password is used to protect some worksheets...
The VB script is also password protected.
There is a before save macro that protect & hides sheets. This is to
ensure that if macros are disabled the sheets are not visible - ie the
thing will only work with macros enabled.
Anyway I need a way in VB to set all this - at the moment I have to get
the user to change the protect password manually and then ediut the VB
script to change the password definition. I'd like it to be the case
that a user knowing the current password can easily change it via a
macro.
Maybe storinng the password in an encrypted way - but again I'd need to
be abel to test user input against this.
I need it such that without the password normal users cant discover
it.
I think I can achiueve what I need if there is a way to get one macro
to change a line in a different macro I coudl carry on with my current
method.
I had thought about storing the passord in a hidden sheet, however it
was then trivial to reference that cell from another sheet in another
file and discover the password.
Any help /advice appreciated.
Teh sheet itself is not password protected on open - it doesnt need
that - just some macros I restrict by prompting for a password and then
checkign int he macros itself that it mateches the global variable.
Regards
Clive
--
ccarmock
------------------------------------------------------------------------
ccarmock's Profile:
http://www.excelforum.com/member.php...o&userid=27670
View this thread: http://www.excelforum.com/showthread...hreadid=497425