This works using excel 2003
But this does not, Why
Code:
Sub ChangeVBACodeName()
'will change the active sheets code name to MySheet25
Dim SN As String
SN = ActiveSheet.Name
ThisWorkbook.VBProject.VBComponents(SN).Name = "MySheet25"
End Sub
But this does not, Why
Code:
Sub test()
Dim SN As String
Sheets.Add.Move after:=Sheets(1)
ActiveSheet.Name = "Sheet22"
SN = ActiveSheet.Name
ThisWorkbook.VBProject.VBComponents(SN).Name = "MySheet25"
End Sub