Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
RV RV is offline
external usenet poster
 
Posts: 11
Default Changing of Sheet Codes for the worksheets...

Hi,

I using the worksheet code obtained using CodeName property of the
worksheet object. Before saving the workbook, I just reshuffled the
worksheets in the workbook by moving them. Now if I just reopen this saved
workbook, to my surprise I found that the code name returned using
the CodeName property on worksheet object is different from that used to
returned when the workbook was opened first time.

I have found on other sites that CodeName for worksheet never changes.

Can anyone please clear my concept on the CodeName?

Thanks and With Warm Regads,

-Rahul Vakil
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Changing of Sheet Codes for the worksheets...

Read the VBA help menu on codename

Its possible for the sheet name to be different from the code name. When
you create a sheet, the sheet name and code name are the same, but changing
the sheet name doesnt change the code name, and changing the code name
(using the Properties window in the Visual Basic Editor) doesnt change the
sheet name.

Note The value that you see in the cell to the right of (Name) in the
Properties window is the code name of the selected object. At design time,
you can change the code name of an object by changing this value. You cannot
programmatically change this property at run time.



"RV" wrote:

Hi,

I using the worksheet code obtained using CodeName property of the
worksheet object. Before saving the workbook, I just reshuffled the
worksheets in the workbook by moving them. Now if I just reopen this saved
workbook, to my surprise I found that the code name returned using
the CodeName property on worksheet object is different from that used to
returned when the workbook was opened first time.

I have found on other sites that CodeName for worksheet never changes.

Can anyone please clear my concept on the CodeName?

Thanks and With Warm Regads,

-Rahul Vakil

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Changing of Sheet Codes for the worksheets...

Depending on security settings (trusting access to Visual basic project), the
codename can be changed.

dim wks as worksheet
set wks = thisworkbook.worksheets("aaa")
ThisWorkbook.VBProject.VBComponents(wks.codename). Name = "NewCodeName"
'or
ThisWorkbook.VBProject.VBComponents(wks.CodeName) _
.Properties("_CodeName").Value = "NewCodeName2"

Joel wrote:

<<snipped

Note The value that you see in the cell to the right of (Name) in the
Properties window is the code name of the selected object. At design time,
you can change the code name of an object by changing this value. You cannot
programmatically change this property at run time.

<<snipped
--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Changing of Sheet Codes for the worksheets...

There's a bug in the way that the codename works.

If you open the VBE after you change the codename (or insert the sheet), that's
enough to "set" the code name.

Here's a discussion that you may want to read:
http://groups.google.co.uk/group/mic...e0751c3d600448
or
http://snipurl.com/1yxzp

RV wrote:

Hi,

I using the worksheet code obtained using CodeName property of the
worksheet object. Before saving the workbook, I just reshuffled the
worksheets in the workbook by moving them. Now if I just reopen this saved
workbook, to my surprise I found that the code name returned using
the CodeName property on worksheet object is different from that used to
returned when the workbook was opened first time.

I have found on other sites that CodeName for worksheet never changes.

Can anyone please clear my concept on the CodeName?

Thanks and With Warm Regads,

-Rahul Vakil


--

Dave Peterson
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
Changing footers on all worksheets without changing print set up KC Excel Discussion (Misc queries) 1 October 26th 07 03:31 PM
Creating a unique list of Cost Codes in Col. A from all worksheets in all workbooks in folder X u473 Excel Programming 1 October 22nd 07 05:24 PM
Changing codes cj21 Excel Discussion (Misc queries) 3 September 2nd 05 03:08 PM
Copy sheet and strip all vba codes helmekki[_55_] Excel Programming 0 November 10th 04 03:38 AM
Performing codes on different worksheets Darren[_8_] Excel Programming 2 September 30th 04 03:36 AM


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