change a const variable by using a macro

D

dunny_budgie

Hopefully a simple question for all you VB experts out there. I have built a
spreadsheet which, for various reasons, has been password protected. There
are a number of macros running various functions on the spreadsheet, and i
have used the 'Const' function in VB to identify the password for use with
these macros. The macros then call on the const variable when necessary.
The same password is also used for the Project Property, to restrict access
to viewing the macros.

Now, what i want to do is create a macro that brings up a dialog box,
prompting the user for a new password. When the user enters a new password,
the Const variable in my macro is then changed. At the same time, i want the
Password on the Project Properties to change to the new password.

Is this possible? Can anyone help?
 
B

Beth Melton

For your code why are you using a constant? You should use a variable.
A constant is just that, a constant, a non-changing value. You just
need a variable and assign the value when your project loads.

Regarding accessing the project properties programmatically, I don't
think this can be done but you may want to check with the Excel VBA
newsgroup to find out for certain.

Please post all follow-up questions to the newsgroup. Requests for
assistance by email can not be acknowledged.

~~~~~~~~~~~~~~~
Beth Melton
Microsoft Office MVP

Office 2007 Preview Site:
http://www.microsoft.com/office/preview/default.mspx
Office 2007 Community Articles/Tutorials:
http://www.microsoft.com/office/preview/community/article_archive.mspx

TechTrax eZine: http://mousetrax.com/techtrax/
MVP FAQ site: http://mvps.org/
 
Top