D
Dave Peterson
ThisWorkbook.VBProject.VBComponents("Sheet1").Name = "NewCodeName"
where sheet1 is the code name
or
dim wks as worksheet
set wks = activesheet
ThisWorkbook.VBProject.VBComponents(wks.codename).Name = "NewCodeName"
'or
ThisWorkbook.VBProject.VBComponents(wks.CodeName) _
.Properties("_CodeName").Value = "NewCodeName2"
But you'll have to toggle a security setting
tools|macro|security|trusted publisher tab
check "trust access to Visual basic project"
(added in xl2002 IIRC--who knows where it's hiding in xl2007 <vbg>.)
where sheet1 is the code name
or
dim wks as worksheet
set wks = activesheet
ThisWorkbook.VBProject.VBComponents(wks.codename).Name = "NewCodeName"
'or
ThisWorkbook.VBProject.VBComponents(wks.CodeName) _
.Properties("_CodeName").Value = "NewCodeName2"
But you'll have to toggle a security setting
tools|macro|security|trusted publisher tab
check "trust access to Visual basic project"
(added in xl2002 IIRC--who knows where it's hiding in xl2007 <vbg>.)