I am trying to build a small app that interops with Micrososft Excel (2007 if it matters). My app would launch and connect to an instance of Excel and place (programatically) one or more shapes on a sheet.
I need to prohibit users from moving and/or resizing these shapes. I could protect the sheet but I need to allow the users to edit cell contents and to resize rows and/or columns.
Is there any way to achieve this?
If I can’t prohibit at least can I detect move/resize events of shapes and put them back programatically at the end of the drag?
You can actually protect the sheet without locking the cell contents, you also do not need to modify the cell properties to indicate they are unlocked.
I haven’t used Interop before, but here’s the code in VBA. This allows contents to be modified, rows and columns to be adjusted, but no shape manipulation. I’m sure you or someone else can easily translate this as it is just the Protect method of the worksheet with parameters.