Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 127
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 415
Default 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" ...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
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
Losing date format when saving .csv files Harley Excel Discussion (Misc queries) 10 December 31st 08 08:46 PM
Help, losing protection & read only with worksheets emailed out greg Excel Discussion (Misc queries) 0 February 15th 07 07:15 PM
Losing Cell Protection When Saving Workbook Chaplain Doug Excel Discussion (Misc queries) 5 August 23rd 06 12:28 AM
saving dbf file without losing data govworker Excel Discussion (Misc queries) 0 February 7th 05 11:27 PM
Losing conditional formatting when saving Eric FD Excel Discussion (Misc queries) 3 January 18th 05 11:42 PM


All times are GMT +1. The time now is 11:45 PM.

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"