Protecting an Excel worksheet from being renamed

  • Thread starter Thread starter JAC
  • Start date Start date
J

JAC

Does anyone know how I can protect a worksheet from being renamed by
the user without stopping him/her from amending (or adding) values to
that worksheet?

All I want to do is to stop renaming!
 
Don't know if it's the most efficient way, but I have achieved this by:

1) turning off the ribbon (this is in Office '07, there is a similar
capablity with earlier versions);
Private Sub Workbook_Open()
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)"

2) disable right-click functionality
Private Sub Workbook_Open()
Application.CommandBars("Ply").Enabled = False

3) lock and protect all sheets

I'm no programmer, but was able to do build a VBA solution by searching
through these forums for similar problems & solutions and adapting them.

HTH

Dave
 
If your reason for wanting this is that renaming worksheets stops your VBA
code working try using Worksheet.codename in your code rather than
Worksheet.Name.

Charles
__________________________________________________
The Excel Calculation Site
http://www.decisionmodels.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top