I have a worksheet where I am attempting to have a master copy to work on and also a read-only copy for other people to view. I would also like this read-only copy to be completely protected to prevent any accidental editing in any of the cells prompting warning messages to pop-up.
I have the save as read-only copy portion of the code that works well and am wondering how I would include a protect worksheet event within this:
Thanks!
I have the save as read-only copy portion of the code that works well and am wondering how I would include a protect worksheet event within this:
VBA Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Const PathWorkListReadOnly As String = "File Path"
Application.DisplayAlerts = False
On Error Resume Next
VBA.SetAttr PathWorkListReadOnly, vbNormal
ActiveWorkbook.SaveCopyAs Filename:=PathWorkListReadOnly
VBA.SetAttr PathWorkListReadOnly, vbReadOnly
Application.DisplayAlerts = True
End Sub
Thanks!