Sheets(2) = 2nd tab? = Sheet2 (Sheet2)?

  • Thread starter Thread starter Max
  • Start date Start date
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>.)
 

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