Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default Override protected sheet message?

My sheet is "protected". The user is only allowed to select
locked or unlocked cells. If a user tries to double click on any cell
or change data, Excel shows the following message box:

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

Does anyone know if it's possible to override this default message
box? It would be nice if I could display my own custom message
box, or run my own subroutine if a user tries to change data on a
protected sheet. I doubt it's possible, but I just want to check if
anyone here knows how to do this??

Thank you!

Robert


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default Override protected sheet message?

You can trap the user double-clicking cells in the
Worksheet_BeforeDoubleClick event. Here, you can display your own
message and cancel Excel's notification message (Cancel = True).

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default Override protected sheet message?

GS has brought this to us :
You can trap the user double-clicking cells in the
Worksheet_BeforeDoubleClick event. Here, you can display your own message and
cancel Excel's notification message (Cancel = True).


Note, however, that this approach doesn't trap if the user presses the
F2 key. Use Application.OnKey to enable/disable this shortcut while
your app is running...

At startup:
Application.OnKey "{F2}", "" '//disable
OR
Application.OnKey "{F2}", "TrapCellEditing" '//run your code

...and be sure to reset it at shutdown...

Application.OnKey "{F2}" '//reset to normal behavior

In your Worksheet_BeforeDoubleClick event you can redirect to the same
procedure...

Cancel = True: Call TrapCellEditing

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default Override protected sheet message?

"GS" wrote:

You can trap the user double-clicking cells in the
Worksheet_BeforeDoubleClick event. Here, you can display your own
message and cancel Excel's notification message (Cancel = True).


Outstanding! Thanks again for your expertise Garry!


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default Override protected sheet message?

Robert Crandal has brought this to us :
"GS" wrote:

You can trap the user double-clicking cells in the
Worksheet_BeforeDoubleClick event. Here, you can display your own message
and cancel Excel's notification message (Cancel = True).


Outstanding! Thanks again for your expertise Garry!


Always happy to help, Robert!

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
2007 Ribbon control disabled by Excel when sheet is protected - Override with getEnabled? Jim Rech[_2_] Excel Programming 2 February 20th 08 08:44 PM
Relacing default Excel message box when user attempts to change locked cell on protected sheet. Chrisso Excel Programming 2 March 19th 07 04:55 PM
Intercept/replace standard 'cell protected' message with my own message? KR Excel Programming 3 March 16th 06 02:31 PM
Protected Sheet Message tlosgyl3 Excel Discussion (Misc queries) 2 December 8th 05 08:13 AM
Error message with protected sheet HRman Excel Discussion (Misc queries) 1 November 28th 05 06:59 PM


All times are GMT +1. The time now is 07:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"