I am protecting a sheet with a password - not a high security thing just to avoid 'accidental' mishaps by users who don't understand the implications. Rather than hard coding the password throughout my modules, I wanted to set it using the Workbook_Open event.
So, in ThisWorkbook I included:
However this variable does not appear to be available to CommandButtons or other modules.
Any suggestions?
Gavin
So, in ThisWorkbook I included:
Code:
Public myPassword As String
Private Sub Workbook_Open()
myPassword = "password"
End Sub
And in other modules
ActiveSheet.Unprotect (myPassword)
ActiveSheet.protect (myPassword)
Any suggestions?
Gavin