This relates to Excel 2003 VBA
I would like to protect the code associated with a workbook by assigning a
password in the Project Properties dialog (Protection tab) to prevent users
viewing or changing the code. However, once I give it a password, when the
user closes the workbook, he is prompted for the password.
To try and isolate the problem, I've set up a simple spreadsheet,
FormTest.xls, which contains a single Show Form button that shows a form
(TestForm). The form has an OK button which hides the form. That's all.
I see the following behaviour …
1. Open the FormTest.xls spreadsheet (enable macros if necessary)
2. Click the Show Form button
3. In the TestForm form that is displayed, press OK (the form is removed)
4. Close the workbook
5. Excel closes, but then …
6. A dialog appears asking for the FormTest password – WHY?
The only code is:
For the Show Form button on the worksheet:
Private Sub ShowFormButton_Click()
TestForm.Show
End Sub
For the TestForm form:
Private Sub OKButton_Click()
TestForm.Hide
End Sub
I have tried unloading the form when the workbook is closed but that seems
to have no effect.
If the code is not password protected, then it all works fine.
Any ideas??
Bookmarks