![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Mar 2002
Posts: 16
|
We have a worksheet with 2 buttons designed to protect and unprotect an excel worksheet.
When you try to edit the worksheet in Excel 97 when it's protected, an error message pops up, and it tells the user how to unprotect the sheet. Is it possible to stop this message coming up? And maybe display a custom message, explaining that the user needs to use our buttons to unprotect the sheet? |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
How about the following code:
If Err.Number = # Then Err.Clear msgbox "Insert your text here" End If Substitute the error number that they are getting with #.
__________________
Kind regards, Al Chara |
|
|
|
|
|
#3 |
|
New Member
Join Date: Mar 2002
Posts: 16
|
Thanks Al
The problem is that this error/dialogue box appears when th eusers are not running any macros so the code which would work in a macro won't work when they're just attempting to alter the sheet; if you see what I mean! dave |
|
|
|
|
|
#4 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Quote:
The msg is a excel system msg...there is no way to circumvent this msg. Ivan |
|
|
|
|
|
|
#5 |
|
New Member
Join Date: Mar 2002
Posts: 16
|
Thanks Ivan,
I feared as much when I tried out everything I could think of and nothing worked. It is a shame because that particular dialogue tells the user how to unprotect the sheet but we wanted them to use our buttons in a custom app! |
|
|
|
|
|
#6 |
|
New Member
Join Date: Mar 2002
Posts: 39
|
Dave
Could you create your own protection using the protection flag? If you used the Worksheet_change Event or Workbook_sheet change Event to check the protect property of the cell you were changing and then display your own message box. I don't want to raise your hopes so please could somebody more familiar with VB confirm is this is viable. Russell |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|