+ Reply to Thread
Results 1 to 3 of 3

Protect cells function

  1. #1
    Bhupinder Rayat
    Guest

    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


  2. #2
    Patrick
    Guest

    RE: Protect cells function

    Where are you prompting for the password? Seems like there is some code
    missing here.

  3. #3
    Bhupinder Rayat
    Guest

    RE: Protect cells function

    Hi,

    ActiveSheet.Unprotect prompts the password, since no password is entered in
    brackets.

    Can anyone help?

    Bhupinder.

    "Patrick" wrote:

    > Where are you prompting for the password? Seems like there is some code
    > missing here.


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1