change sheet codename

  • Thread starter Thread starter Gary Keramidas
  • Start date Start date
G

Gary Keramidas

is there a command to change the codename of a sheet?

tried worksheets("Sheet1").codename = "test"

but i think the codename only retrieves values, it doesn't set them.
 
Maybe...

ThisWorkbook.VBProject.VBComponents("Sheet1").Name = "NewCodeName"

if you don't know the original codename:

dim wks as worksheet
set wks = activesheet
ThisWorkbook.VBProject.VBComponents(wks.codename).Name = "NewCodeName"
 
With ActiveSheet
.Parent.VBProject.VBComponents(.CodeName) _
.Properties("_CodeName") = "somevalue"
End With



--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
thanks, dave, needed the 2nd example because i was inserting a sheet and have no
idea what name excel is assigning to it. i only have 20 sheets, but probably
because of manipulating things excel was give codenames in the 30's.
 
thanks bob, i'll give it a try

--


Gary


Bob Phillips said:
With ActiveSheet
.Parent.VBProject.VBComponents(.CodeName) _
.Properties("_CodeName") = "somevalue"
End With



--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
Back
Top