Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Prevent Editing of Worksheets w/in SpreadsheetML
I need to be able to lock worksheets against being edited (well, and allow
sections to be editable). This would be a trivial task, but I need to be able to do it by manipulating the XML representation of an Excel document (working against Excel 2003, for the record). I can't simply use Excel to do this, save it to XML, and then see what's changed, because Excel strips out protection information when you do that. I've spent a great deal of time looking at the schemas, fiddling with a SpreadsheetML file and seeing what elements and attributes pop up when... but no luck. I've figured out how to Protect the Workbook and how to Protect a Worksheet, and I can find attributes that allow/disallow pretty much anything you'd like to be able to restrict on cells... except for content editing. I simply cannot find where I: 1) Tell Excel to prevent the editing of cells. 2) Tell Excel to allow the editing of specific cells while the rest of the sheet is locked. Does anyone know how to do this? I'm at loss. Thanks! Richard |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Prevent Editing of Worksheets w/in SpreadsheetML
Why don't you get an image of the Excel Worksheet and distribute that
instead? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Prevent Editing of Worksheets w/in SpreadsheetML
The requirements of what I'm working on. This isn't about distributing an
..xls file, it's about generating an .xls file for distribution. This sort of thing can be done programmatically through OfficeInterop but, as most of the work is being done to the XML version, it'd be silly to go through the extra step of doing this one thing that way unless it's absolutely the only option. when " wrote: Why don't you get an image of the Excel Worksheet and distribute that instead? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Prevent Editing of Worksheets w/in SpreadsheetML
Do you know how to add VBA macros to the XL VBA representation?
|
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Prevent Editing of Worksheets w/in SpreadsheetML
Hi R Rush - I was wondering if you ever found an answer to your question. I
too am trying to programmatically protect specific cells but have only been able to protect the entire worksheet. In my scenario, I generate XML code via Access which in turn creates an Excel spreadsheet. I have successfully created the spreadsheet, added and formatted specific rows but the protection tags seem to protect the entire worksheet. Any advice would be greatly appreciated. "R Rush" wrote: Crud. Apparently, like protection information, SpreadsheetML doesn't retain VBA code when transformed into XML. I'm starting to guess that as otherwise as silly as it may be, I'm going to have to do this programmatically. Bah. " wrote: Do you know how to add VBA macros to the XL VBA representation? |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Prevent Editing of Worksheets w/in SpreadsheetML
r rush's profile says he hasn't posted anything since this thread - i
doubt if he's still reading it (or even the newsgroup). if you check his profile you might be able to get an e-mail address for him. just thought i'd save you waiting for an answer (altho you never know, he may!). susan On Mar 14, 11:30 am, franciepants wrote: Hi R Rush - I was wondering if you ever found an answer to your question. I too am trying to programmatically protect specific cells but have only been able to protect the entire worksheet. In my scenario, I generate XML code via Access which in turn creates an Excel spreadsheet. I have successfully created the spreadsheet, added and formatted specific rows but the protection tags seem to protect the entire worksheet. Any advice would be greatly appreciated. |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Prevent Editing of Worksheets w/in SpreadsheetML
Thx Susan - I'll do that
"Susan" wrote: r rush's profile says he hasn't posted anything since this thread - i doubt if he's still reading it (or even the newsgroup). if you check his profile you might be able to get an e-mail address for him. just thought i'd save you waiting for an answer (altho you never know, he may!). susan On Mar 14, 11:30 am, franciepants wrote: Hi R Rush - I was wondering if you ever found an answer to your question. I too am trying to programmatically protect specific cells but have only been able to protect the entire worksheet. In my scenario, I generate XML code via Access which in turn creates an Excel spreadsheet. I have successfully created the spreadsheet, added and formatted specific rows but the protection tags seem to protect the entire worksheet. Any advice would be greatly appreciated. |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Prevent Editing of Worksheets w/in SpreadsheetML
I've still got notifications turned on, actually.
Didn't expect a response here, but I got it, anyway. :) "Susan" wrote: r rush's profile says he hasn't posted anything since this thread - i doubt if he's still reading it (or even the newsgroup). if you check his profile you might be able to get an e-mail address for him. just thought i'd save you waiting for an answer (altho you never know, he may!). susan On Mar 14, 11:30 am, franciepants wrote: Hi R Rush - I was wondering if you ever found an answer to your question. I too am trying to programmatically protect specific cells but have only been able to protect the entire worksheet. In my scenario, I generate XML code via Access which in turn creates an Excel spreadsheet. I have successfully created the spreadsheet, added and formatted specific rows but the protection tags seem to protect the entire worksheet. Any advice would be greatly appreciated. |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Prevent Editing of Worksheets w/in SpreadsheetML
No, I never found the solution to locking stuff down within the XML.
Ultimately, what I ended up having to do is: 1. Do as much as I can with the SpreadsheetML document 2. Programmatically open the SpreadsheetML doc as an Excel workbook and apply locking / cell editing. Not the best of worlds, but I've resigned myself to it. In terms of advice, the only thing I can think of offering is the process for locking down a spreadsheet programmatically goes kinda like this: For each cell range you want to keep editable: currentRange.Locked = false For each worksheet you want locked currentSheet.Protect(password) And then workbook.Protect(password) It's sorta backwards: where you probably (and I do) want to specify certain cell ranges that cannot be editable, Excel works the other way. In Excel, you're describing what cells you want to continue to be editable. You have to opt-in instead of opt-out. Hope that helps! Rush "franciepants" wrote: Hi R Rush - I was wondering if you ever found an answer to your question. I too am trying to programmatically protect specific cells but have only been able to protect the entire worksheet. In my scenario, I generate XML code via Access which in turn creates an Excel spreadsheet. I have successfully created the spreadsheet, added and formatted specific rows but the protection tags seem to protect the entire worksheet. Any advice would be greatly appreciated. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Removing protections that prevent me from editing formulas. | Excel Worksheet Functions | |||
How to prevent editing within a specific cells? | Excel Discussion (Misc queries) | |||
How do I prevent editing in a cell based on the value in another? | Excel Worksheet Functions | |||
Prevent Locked for Editing on a network | Excel Programming | |||
Permit DoubleClick but prevent other editing | Excel Programming |