ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Password set/clear macros - help! (https://www.excelbanter.com/excel-programming/281504-password-set-clear-macros-help.html)

Ken Bosward

Password set/clear macros - help!
 
Hi all,

I would like to implement two custom toolbar buttons to allow colleagues on
a committee to easily set and clear workbook passwords. They use a mix of
Excel 2000 and 2002. Setting a password would work something like this:
1. The person opens the workbook.
2. At any time during editing, the person presses the "set password" button
to set the password. If this is the first time the button is pressed after
Excel is started, then prompt for the password. Subsequent presses of the
button will apply the same password to the active workbook without
prompting.
3. When finished editing, the person saves and closes the workbook, which
applies the password.

This is easily done in Excel 2002. I simply set the ActiveDocument.Password
(or ActiveWorkbook.Password) property and the password is applied when the
document or workbook is next saved (the same is true for both Word 2000 and
2002). However there is no such property in Excel 2000; it seems the
password can only be applied using the SaveAs method. I would like this to
work the same way in both versions of Excel. I started looking at workbook
BeforeSave events, but that's getting complicated.

Oh, and the macros/custom toolbar would need to be loaded from an add-in,
since I want them to be usable on any workbook. And it would be nice if the
"set password" button could be highlighted in some way if the active
workbook has a password set.

Thanks,
Ken.




All times are GMT +1. The time now is 08:53 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com