-
Dave,
I'm thinking why not be both sneeky and proactive here? - I'm assuming the VBE window is protected of course...[vba]Option Explicit
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
For Each Sh In ThisWorkbook.Worksheets
If Sh.ProtectContents = False Then
Mail_Small_Text_CDO
With Application
.EnableEvents = False
On Error Resume Next
.Undo '< undo any changes
.EnableEvents = True
End With
'set a NEW password here
Sh.Protect password:="123"
Exit For
End If
Next
End Sub[/vba]
(edited to insert basic error handler)
You know you're really in trouble when the light at the end of the tunnel turns out to be the headlight of a train hurtling towards you
The major part of getting the right answer lies in asking the right question...
Made your code more readable, use VBA tags (this automatically inserts [vba] at the start of your code, and [/vba ] at the end of your code) | Help those helping you by marking your thread solved when it is.
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