Transfer The Module from One workbook to another

  • Activate below mentioned Liabrary:
  •  

    Display all the Components on Message Box

    For M = 1 To ActiveWorkbook.VBProject.VBComponents.Count
    MsgBox ActiveWorkbook.VBProject.VBComponents(M).Name
    Next

     

    Remove Module2 from the workbook

    Dim Proj As VBIDE.VBProject
    Dim Comp As VBIDE.VBComponent
    Set Proj = ActiveWorkbook.VBProject
    Set Comp = Proj.VBComponents("Module2")
    Proj.VBComponents.Remove Comp