View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default How disable an Excel dialog box?

In the worksheet module (or adapted in ThisWorkbook)

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
If Target.Parent.ProtectContents Then
If Target.Locked Then
Cancel = True
MsgBox "don't touch"
End If
End If

End Sub

But no way to intercept if user starts typing in a protected cell

Regards,
Peter T

"Robert Crandal" wrote in message
...
My entire spreadsheet is locked/password protected in
such a manner that users cannot select any locked or unlocked
cells.

However, if a user double clicks on any cell, Excel will display
a dialog box that says the following:

"The cell or chart you are trying to change is protected and
therefore read-only!...." etc, etc....

Is it possible to disable this particular dialog box so I can display
my own custom userform instead?? Can I somehow place some
code in the "Worksheet_BeforeDoubleClick()" event subroutine
to tell Excel to display my own custom userform??

Thank you everyone!