In the attached I've applied sheet level protection with passwords using "Review / Protect Sheet". These passwords are currently set to the same as you had in the VBA in your example workbook.
Sheets can be unprotected via "Review / Unprotect Sheet" using the relevant password.
The code below is placed in the ThisWorkbook module (the same place you had your workbook open event code).
The code will fire each time the file is saved. The first part of the code will loop through all sheets in the workbook and close any expanded groups.
The second part will protect all sheets with specified passwords.
If you lock the VBA down via "Tools / VBAProject Properties / Protection" in the VB Editor then the passwords are safe from prying eyes (well as safe as Excel gets!).
Is that of any use to you?
BSB
Bookmarks