Cycling through Macros & replacing a earlier with later version:   Return to List

Count = 0
' ****************** Compiling a List of Macros in the Project ************
Dim MyMacroList()
For k = 1 To NormalTemplate.VBProject.VBComponents.Count
    Count = Count + 1
    ReDim Preserve MyMacroList(Count)
    MyMacroList(Count) = NormalTemplate.VBProject.VBComponents.Item(k).Name
Next

' ******************* Cycling through the List to see if we have later versions *****
For k = 1 To UBound(MyMacroList())
    CurrName = MyMacroList(k)
    For j = 1 To UBound(MyMacroList())
        If MyMacroList(j) = CurrName & "1" Then
            NormalTemplate.VBProject.VBComponents.Remove NormalTemplate.VBProject.VBComponents.Item(CurrName)' Removing an earlier version
    ' Renaming later
            NormalTemplate.VBProject.VBComponents.Item(CurrName & "1").Name = CurrName
        End If
    Next
Next



Note to Webmaster