How to have workbook automatically protect when closed (or opened)

  • Thread starter Thread starter DrewParkinson
  • Start date Start date
D

DrewParkinson

Hi,

I have a spreadsheet (MS Excel 2003) that is currently shared over a
network among many users. Currently, we have some columns protected
from editing. However, some of the user base who edit the sheet and
have the password tend to not protect the workbook again after they
are doing edits (managers).

Anyone know of a macro or other method that would have the workbook
automatically be protected, even if it was saved unprotected? Possibly
protected on close/open, or on save?

Thanks,
Drew
 
Paste this into the ThisWorkbook Module

Private Sub Workbook_BeforeClose(Cancel As Boolean)
'Replace "Password" with your password that you use
'this will set password when closing workbook
ActiveSheet.Protect "Password", True
ActiveWorkbook.Protect "Password", True

End Sub
 
Paste this into the ThisWorkbook Module

Private Sub Workbook_BeforeClose(Cancel As Boolean)
'Replace "Password" with your password that you use
'this will set password when closing workbook
ActiveSheet.Protect "Password", True
ActiveWorkbook.Protect "Password", True

End Sub

Wow, awesome thanks for the quick response, works perfectly~
 
Back
Top