Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default prevent change sheet name


Hi there

Is there a code to protect the name of sheets ?

i donot want to let users change the name of the worksheets


--
helmekki


------------------------------------------------------------------------
helmekki's Profile: http://www.excelforum.com/member.php...fo&userid=6939
View this thread: http://www.excelforum.com/showthread...hreadid=384357

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default prevent change sheet name

Nope there is no way to stop the user from changing the sheet tab names. You
can either train all of your users to never change the tab names or you can
write code that does not refer to the tab name (this is my prefered method).
Instead of refering to the sheet
Sheets("Sheet1").Select
change it to
Sheet1.Select

Note that you can change the code name of the sheet in the properties window
to something more appropriate than Sheet1 like shtMySheet by changing the
value beside (Name).
--
HTH...

Jim Thomlinson


"helmekki" wrote:


Hi there

Is there a code to protect the name of sheets ?

i donot want to let users change the name of the worksheets


--
helmekki


------------------------------------------------------------------------
helmekki's Profile: http://www.excelforum.com/member.php...fo&userid=6939
View this thread: http://www.excelforum.com/showthread...hreadid=384357


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,173
Default prevent change sheet name

Helmekki

Is this because you are referring to them in code? If so then use the
CodeName. This can be set at design time (easy) or runtime (more tricky)
and they can't be changed from the UI

E.g if you set the codename for a sheet to Sheet1 (default for sheet 1) you
can refer to it as

Sheet1.Range("A1").Value=12345

It then doesn't matter what the tab name is

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"helmekki" wrote in
message ...

Hi there

Is there a code to protect the name of sheets ?

i donot want to let users change the name of the worksheets


--
helmekki


------------------------------------------------------------------------
helmekki's Profile:
http://www.excelforum.com/member.php...fo&userid=6939
View this thread: http://www.excelforum.com/showthread...hreadid=384357



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default prevent change sheet name

Hi Helmekki,

i donot want to let users change the name of the worksheets


Why not?

If you use the sheets' code names for manipulation purposes, any user change
to a sheet name should not adversely affect you, the developer.

In any event, any moderately savvy Excel user knows that a sheet can be
renamed. Why, therefore, seel to engender user animosity unnecessarily?

---
Regards,
Norman



"helmekki" wrote in
message ...

Hi there

Is there a code to protect the name of sheets ?

i donot want to let users change the name of the worksheets


--
helmekki


------------------------------------------------------------------------
helmekki's Profile:
http://www.excelforum.com/member.php...fo&userid=6939
View this thread: http://www.excelforum.com/showthread...hreadid=384357



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default prevent change sheet name

If you are going to refer to them by their codename as other have
smartly suggested, always change the codename to something other than
the default. Here's the catch (tested in Excel97). Say you have three
sheets and your program refers to codename "Sheet2". Somehow sheet2
gets deleted and a new sheet added. Tha tab name will be Sheet4, but
the code name will be Sheet2. Probably not the sheet2 that your program
refers to.

If you don't want a sheetname to change, try checking the name in the
worksheet activate and/or deactivate events, and change it back if it
has changed. Not perfect, but maybe it will work for you.

Len

helmekki wrote:
Hi there

Is there a code to protect the name of sheets ?

i donot want to let users change the name of the worksheets




  #6   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default prevent change sheet name

If you do try to the sheet activate/deactivate route, you will also need to
capture the active sheet name when the workbook is opened. Otherwise the
user could change the sheet name of whatever sheet is active when the
workbook is first opened.


"LenB" wrote:

If you are going to refer to them by their codename as other have
smartly suggested, always change the codename to something other than
the default. Here's the catch (tested in Excel97). Say you have three
sheets and your program refers to codename "Sheet2". Somehow sheet2
gets deleted and a new sheet added. Tha tab name will be Sheet4, but
the code name will be Sheet2. Probably not the sheet2 that your program
refers to.

If you don't want a sheetname to change, try checking the name in the
worksheet activate and/or deactivate events, and change it back if it
has changed. Not perfect, but maybe it will work for you.

Len

helmekki wrote:
Hi there

Is there a code to protect the name of sheets ?

i donot want to let users change the name of the worksheets



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default prevent change sheet name


Another ways is to protect the tabs via Workbook protection (Tools /
Protection / Protect WorkBook) manually.


Code:
--------------------
via code use ActiveWorkbook.protect [password:="Pepe" (opcional)]
ActiveWorkbook.unprotect [password:="Pepe" (opcional)]
--------------------



Hope this helps you

Jose Luis


--
jose luis
------------------------------------------------------------------------
jose luis's Profile: http://www.excelforum.com/member.php...o&userid=13312
View this thread: http://www.excelforum.com/showthread...hreadid=384357

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
How to prevent Cut&Paste to change style and data validation on protected sheet Paulo Costa \(Live\) Excel Discussion (Misc queries) 1 March 23rd 10 12:19 PM
How to prevent Cut&Paste to change style and data validation on protected sheet Paulo Costa \(Live\) Excel Discussion (Misc queries) 2 March 23rd 10 05:17 AM
Prevent color change open/save sheet? Julie Moorehouse Excel Discussion (Misc queries) 0 July 29th 09 03:35 PM
prevent change in author joel Excel Discussion (Misc queries) 1 February 9th 06 02:38 PM
How do I protect a macro to prevent change ? Keisamcasco Excel Discussion (Misc queries) 3 August 27th 05 09:50 PM


All times are GMT +1. The time now is 11:28 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"