PC Review


Reply
Thread Tools Rate Thread

How disable an Excel dialog box?

 
 
Robert Crandal
Guest
Posts: n/a
 
      23rd Feb 2010
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!


 
Reply With Quote
 
 
 
 
Peter T
Guest
Posts: n/a
 
      23rd Feb 2010
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" <(E-Mail Removed)> wrote in message
news:mdYgn.4184$(E-Mail Removed)...
> 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!
>
>



 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      23rd Feb 2010
Not that I've seen.

But you could prohibit the selection of locked cells so that the user won't even
see the message.

Look in the Tools|Protection|protect sheet dialog (xl2002 or higher).

Or do it in code (any version):

Option Explicit
Sub auto_open()
Dim wks As Worksheet
Set wks = ThisWorkbook.Worksheets("Sheet1")

With wks
.EnableSelection = xlUnlockedCells
.Protect Password:="hi"
End With

End Sub

By naming it Auto_Open and putting it in a general module, it'll run whenever
excel opens this file (and the user allows macros to run).



Robert Crandal wrote:
>
> 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!


--

Dave Peterson
 
Reply With Quote
 
Robert Crandal
Guest
Posts: n/a
 
      23rd Feb 2010
Thank you very much Peter....I have a second question now.

In the line that says "MsgBox 'don't touch'", how can I make
the message box show the current row & column that was double clicked???

Thank u



"Peter T" <peter_t@discussions> wrote in message
news:(E-Mail Removed)...
> 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
>


 
Reply With Quote
 
Peter T
Guest
Posts: n/a
 
      24th Feb 2010
Dim sMsg As String
' code
With Target
sMsg = "Address:" & .Address(0, 0) & " Row:" & .Row & " Col:" & .Column
End With
MsgBox sMsg

Regards,
Peter T

"Robert Crandal" <(E-Mail Removed)> wrote in message
news:C2Zgn.8053$(E-Mail Removed)...
> Thank you very much Peter....I have a second question now.
>
> In the line that says "MsgBox 'don't touch'", how can I make
> the message box show the current row & column that was double clicked???
>
> Thank u
>
>
>
> "Peter T" <peter_t@discussions> wrote in message
> news:(E-Mail Removed)...
>> 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
>>

>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Disable a Dialog Box =?Utf-8?B?QW5nZWw=?= Microsoft Word Document Management 2 5th Jan 2006 05:58 PM
disable dialog box Jean-Paul De WInter Microsoft Access Reports 1 22nd Jun 2005 01:24 PM
disable printing dialog box Winshent Microsoft Access Reports 1 18th Jun 2005 06:39 PM
How to disable a dialog box? =?Utf-8?B?dmlja2V5YW5uZQ==?= Windows XP New Users 1 26th May 2005 08:48 PM
Disable Query Refresh warning dialog box in Excel 2003 =?Utf-8?B?SmVmZiBLb29ucw==?= Microsoft Excel Misc 1 10th Dec 2004 05:11 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:56 AM.