This code is adapted from the original information by Chip Pearson. PLEASE READ THE ORIGINAL INFORMATION BEFORE USING THIS, you can quite easily break Excel if you don't know what you're doing.
Option Explicit
'v1.00 2013-05-02 13:10
'Reference http://www.cpearson.com/excel/codemods.htm
'VBA code to update sheet, workbook, etc. code names
Sub vbProjectCodeName(ByVal NewName As String, ByRef wb As Workbook)
wb.VBProject.Name = NewName
End Sub
Sub vbWorkbookCodeName(ByVal NewName As String, ByRef wb As Workbook)
'!! use with caution, default object name is ThisWorkbook (you can always reset it afterwards)
wb.VBProject.VBComponents(wb.CodeName).Name = NewName
End Sub
Sub vbWorksheetCodeName(ByVal NewName As String, ByRef wb As Workbook, ByRef ws As Worksheet)
wb.VBProject.VBComponents(ws.CodeName).Name = NewName
End Sub
No comments:
Post a Comment