LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default Protect cells function

I have the following code that unprotects a sheet and a workbook.

On Error GoTo errorHandler
ActiveSheet.Unprotect 'Unprotects the
sheet: Menu
ActiveWorkbook.Unprotect (123) 'Unprotects the
workbook Sheets("InternalMenu").Visible = True 'Unhides
sheet: Internal Menu
Sheets("JobSheet").Visible = True

Exit Sub
On Error GoTo 0
errorHandler:
MsgBox "The Password you have supplied is incorrect. Please verify that you
have the correct capitilistation."

The trouble is that when you are prompted for the password to unprotect the
sheet, if you press cancel, the code still runs.

How can I manage the cancel button on the Password prompt box to actually
exit the sub when cancel is pressed.

I have tried if unprotect = vbCancel then exit sub, and varaiations of this,
but to no envail.

Can anyone help?

Thanks,

Pinda

 
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
protect cells in excel, but also allow a search in those cells? LindaAlex Excel Worksheet Functions 2 January 28th 10 02:51 PM
How do I protect cells or a range of cells in excel spreadsheet? Abundance Excel Worksheet Functions 1 July 28th 09 11:03 PM
Protect cells but not Group function Please help James Excel Worksheet Functions 10 October 1st 07 10:15 PM
How do I protect cells against only the "Delete" function? Kev Nurse Excel Discussion (Misc queries) 1 February 17th 05 03:09 AM
Lock and protect cells without protect the sheet Christian[_7_] Excel Programming 6 December 28th 04 04:50 PM


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

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

About Us

"It's about Microsoft Excel"