View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Greg Wilson Greg Wilson is offline
external usenet poster
 
Posts: 747
Default Need Code to rename standard modules

You probably know this but ensure that the Microsoft Visual Basic for
Applications Extensibility reference is selected before running the code:

Sub RenameMods()
Dim vbmod As VBComponent
For Each vbmod In ThisWorkbook.VBProject.VBComponents
If vbmod.Type = vbext_ct_StdModule Then
Select Case vbmod.Name
Case "Module1"
vbmod.Name = "HelloWorld_1"
Case "Module2"
vbmod.Name = "HelloWorld_2"
Case "Module3"
vbmod.Name = "HelloWorld_3"
End Select
End If
Next
End Sub

Regards,
Greg

"davidm" wrote:


Can someone kindly help me out with a code to *rename* standard modules?
I have googled in vain for leads. Even Chip Pearson seemed to have miss
this one in his comprehensive coverage of codings to manipulate
VBComponents.

[I intend using the first 8 or so characters of ProcedureTitles to
rename meaningfully and can quite comfortably handle this bit of
extracting the characters].

TIA

David


--
davidm
------------------------------------------------------------------------
davidm's Profile: http://www.excelforum.com/member.php...o&userid=20645
View this thread: http://www.excelforum.com/showthread...hreadid=526630