View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bill Kuunders Bill Kuunders is offline
external usenet poster
 
Posts: 303
Default Macro to protect/unprotect with password

use this macro "before save"


Sub Seal_File()

For Each sheet In Sheets
On Error Resume Next
sheet.Protect ("spw")
Next
Application.StatusBar = ""
End Sub



and this one could be a special key combination
Sub UNSEAL()
ActiveWorkbook.Unprotect ("spw")
For Each sheet In Sheets
On Error Resume Next
sheet.Unprotect ("spw")
Next
Application.StatusBar = "NOT sealed"
End Sub

Note the application status bar commands(optional)
that way you will see at the bottom of your screen whether the sheet is in
the unprotected mode.


Greetings from New Zealand
Bill K
"Cam" wrote in message
...
Hi.
I have an Excel Protected template file (2000') that I need to unprotect
several sheets (20) in order to perform work, then protected back with the
same password to distribute to users.
Currently I am doing this manual which can be time consuming. How can I
create a macro to protect/unprotect sheet with a click of a button?
Thanks for any help and suggestion.