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
Bookmarks