-
Detect an unprotected worksheet automatically
I'm mucking around with a corporate template that sends a CDO message (bypassing Outlook) if a user attempts to unprotect a worksheet
I could muck around with the menu settings and disable the Protect options but this is more fun
Is there a smart way to detect an unprotected sheet - I'm using the code below but I was wondering if there was a smarter way (class module?) to detect an unprotected worksheet
[vba]
Private Sub Workbook_SheetCalculate(ByVal Sh As Object)
Dim ws As Worksheet, NotProt As Boolean
For Each ws In ThisWorkbook.Worksheets
If ws.ProtectContents = False Then
NotProt = True
Exit For
End If
Next
If NotProt Then Mail_Small_Text_CDO
End Sub
[/vba]
Cheers
Dave
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules