ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How do I protect Excel Workbook Structure except adding new sheets (https://www.excelbanter.com/excel-worksheet-functions/192093-how-do-i-protect-excel-workbook-structure-except-adding-new-sheets.html)

Som_Dev

How do I protect Excel Workbook Structure except adding new sheets
 
Hi,
I am exporting some application data to Excel workbook through my C# code.
I would like to Lock the Workbook to prevent users to edit the name of the
sheet and some column data.
But I need to allow user to add new sheet.
Workbook.Protect method allows me to Lock the Structure of the workbook
which includes not allowing to add new sheet.
But As I said I need allow user nothing but adding newworksheet.
How Do I do that ?



Spiky

How do I protect Excel Workbook Structure except adding newsheets
 
On Jun 20, 1:02 pm, Som_Dev wrote:
Hi,
I am exporting some application data to Excel workbook through my C# code.
I would like to Lock the Workbook to prevent users to edit the name of the
sheet and some column data.
But I need to allow user to add new sheet.
Workbook.Protect method allows me to Lock the Structure of the workbook
which includes not allowing to add new sheet.
But As I said I need allow user nothing but adding newworksheet.
How Do I do that ?


You could create a macro that unprotects the workbook, adds a sheet,
then protects the workbook again. And give the users a button to
operate it. And password protect your VBA so they can't see the
workbook password in your code, which shows as plain text.

Som_Dev

How do I protect Excel Workbook Structure except adding new sh
 
Hi Spiky,
Thank you very much for your reply. Do you know How to create custom button
in the toolbar of the sheet ?

"Spiky" wrote:

On Jun 20, 1:02 pm, Som_Dev wrote:
Hi,
I am exporting some application data to Excel workbook through my C# code.
I would like to Lock the Workbook to prevent users to edit the name of the
sheet and some column data.
But I need to allow user to add new sheet.
Workbook.Protect method allows me to Lock the Structure of the workbook
which includes not allowing to add new sheet.
But As I said I need allow user nothing but adding newworksheet.
How Do I do that ?


You could create a macro that unprotects the workbook, adds a sheet,
then protects the workbook again. And give the users a button to
operate it. And password protect your VBA so they can't see the
workbook password in your code, which shows as plain text.


Spiky

How do I protect Excel Workbook Structure except adding new sh
 
On Jun 20, 4:50 pm, Som_Dev wrote:
Hi Spiky,
Thank you very much for your reply. Do you know How to create custom button
in the toolbar of the sheet ?


Toolbar buttons stay with the computer generally, not with the
workbook. So I always make buttons right in a worksheet with the Text
Box drawing tool. This also allows for a real name to show for the
button instead of a tiny picture since the text box can be as large as
you like.

Create a Text Box however you like, I usually add some background
color, rounded corners and shadowing so it looks more like a button.
Right-click on the box and choose Assign Macro. You already have to
have your macro created so you can just pick it from the list. The box
will become clickable, probably with a pointing finger cursor like for
a hyperlink.

Locking the sheet means they cannot mess up the text box/button you
just made.


All times are GMT +1. The time now is 01:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com