+ Reply to Thread
Results 1 to 3 of 3

Losing Cell Protection When Saving Workbook

  1. #1
    Chaplain Doug
    Guest

    Losing Cell Protection When Saving Workbook

    Excel 2003. I programmatically protect each sheet in a workbook as I
    programmatically create the sheets. Moreover, I enable only the unlocked
    cells in the sheets to be selected. I use:

    WkSh.Protect
    WkSh.EnableSelection = xlUnlockedCells

    When I put breakpoints in while debugging I find that the protection is
    working as expected (the sheet is protected and I can only select unlocked
    cells).

    When I am finished creating all the sheets, I then programmatically protect
    the whole work book as:

    WbNew.Protect

    When I check the sheets after this operation, they still behave as desired.
    HOWEVER, when I save the workbook using:

    WbNew.Close SaveChanges:=True

    and then open the workbook, I find the workbook protected (as expected), the
    sheets protected (as expected), but I can select the locked cells in the
    sheets

    What could be causing this? Thanks for the help.

    --
    Dr. Doug Pruiett
    Good News Jail & Prison Ministry
    www.goodnewsjail.org

  2. #2
    NickHK
    Guest

    Re: Losing Cell Protection When Saving Workbook

    That setting is not persistent, it's not saved with the file.
    You have to set it each time the WB is open, probably in the Workbook_Open
    event.

    nickHK

    "Chaplain Doug" <[email protected]> ¼¶¼g©ó¶l¥ó·s»D:[email protected]...
    > Excel 2003. I programmatically protect each sheet in a workbook as I
    > programmatically create the sheets. Moreover, I enable only the unlocked
    > cells in the sheets to be selected. I use:
    >
    > WkSh.Protect
    > WkSh.EnableSelection = xlUnlockedCells
    >
    > When I put breakpoints in while debugging I find that the protection is
    > working as expected (the sheet is protected and I can only select unlocked
    > cells).
    >
    > When I am finished creating all the sheets, I then programmatically
    > protect
    > the whole work book as:
    >
    > WbNew.Protect
    >
    > When I check the sheets after this operation, they still behave as
    > desired.
    > HOWEVER, when I save the workbook using:
    >
    > WbNew.Close SaveChanges:=True
    >
    > and then open the workbook, I find the workbook protected (as expected),
    > the
    > sheets protected (as expected), but I can select the locked cells in the
    > sheets
    >
    > What could be causing this? Thanks for the help.
    >
    > --
    > Dr. Doug Pruiett
    > Good News Jail & Prison Ministry
    > www.goodnewsjail.org




  3. #3
    Dave Peterson
    Guest

    Re: Losing Cell Protection When Saving Workbook

    You have another response at your other thread.

    Chaplain Doug wrote:
    >
    > Excel 2003. I programmatically protect each sheet in a workbook as I
    > programmatically create the sheets. Moreover, I enable only the unlocked
    > cells in the sheets to be selected. I use:
    >
    > WkSh.Protect
    > WkSh.EnableSelection = xlUnlockedCells
    >
    > When I put breakpoints in while debugging I find that the protection is
    > working as expected (the sheet is protected and I can only select unlocked
    > cells).
    >
    > When I am finished creating all the sheets, I then programmatically protect
    > the whole work book as:
    >
    > WbNew.Protect
    >
    > When I check the sheets after this operation, they still behave as desired.
    > HOWEVER, when I save the workbook using:
    >
    > WbNew.Close SaveChanges:=True
    >
    > and then open the workbook, I find the workbook protected (as expected), the
    > sheets protected (as expected), but I can select the locked cells in the
    > sheets
    >
    > What could be causing this? Thanks for the help.
    >
    > --
    > Dr. Doug Pruiett
    > Good News Jail & Prison Ministry
    > www.goodnewsjail.org


    --

    Dave Peterson

+ 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