Q:

Copy all VBA codes from workbook to another

I have searched a lot and found a lot of VBA codes that exports the VBA codes modules but what I need is different a little bit. 
I have a large project with a lot of VBA codes in standard modules, Worksheets modules, ThisWorkbook module.  All of these have VBA codes and there is another workbook say ("New.xlsm") which I need to copy all these VBA codes to it. 
But before exporting those VBA codes, I need to clean the "New.xlsm" from any codes at any module at all or delete any existing module and clean everything ..then copy the vba codes to the "New.xlsm". 
I have this code that exports all VBE components but this may be a step only. 
Sub Export_All_VBE_Components()
'References: Microsoft Visual Basic for Applications Extensibility 5.3
'---------------------------------------------------------------------
    Dim vbComp          As VBIDE.VBComponent
    Dim destDir         As String
    Dim fName           As String
    Dim ext             As String

    If ActiveWorkbook. Path = "" Then MsgBox "You Must First Save This Workbook Somewhere So That It Has A Path.", , " Error": Exit Sub
    destDir = ActiveWorkbook. Path & "\" & ActiveWorkbook.name & " Modules"
    If Dir(destDir, vbDirectory) = vbNullString Then MkDir destDir

    For Each vbComp In ActiveWorkbook. VBProject. VBComponents
        If vbComp. CodeModule. CountOfLines > 0 Then
            Select Case vbComp. Type
                Case vbext_ct_ClassModule: ext = ".cls"
                Case vbext_ct_Document: ext = ".cls"
                Case vbext_ct_StdModule: ext = ".bas"
                Case vbext_ct_MSForm: ext = ".frm"
                Case Else: ext = vbNullString
            End Select

            If ext <> vbNullString Then
                fName = destDir & "\" & vbComp.name & ext
                If Dir(fName, vbNormal) <> vbNullString Then Kill (fName)
                vbComp. Export (fName)
            End If
        End If
    Next vbComp
End Sub

I have solved the first step which will removes all the existing codes from "original.xlm"
Sub Test_RemoveAllMacros()
    Application. ScreenUpdating = False
        RemoveAllMacros Application. Workbooks("Original.xlsm")
    Application. ScreenUpdating = True
End Sub

Sub RemoveAllMacros(wbk As Workbook)
    Dim vbCode As Object, vbComp As Object, vbProj As Object
    Set vbProj = wbk. VBProject
    With vbProj
        For Each vbComp In .VBComponents
            Select Case vbComp. Type
                Case 1, 2, 3
                    vbProj. VBComponents. Remove vbComp
                Case 100
                    Set vbCode = vbComp. CodeModule
                    vbCode. DeleteLines 1, vbCode. CountOfLines
            End Select
        Next vbComp
    End With
End Sub

What I need now is to copy all the macros from the "New.xlm" to "Original.xlsm"
I found this code but this require to name each module that I need to copy.  I don't need to specify any module name as I have about 30 modules and also worksheets modules ..and also ThisWorkbook module
Sub Copy_module()
    Dim varModule, wbkSource As Workbook, wbkTarget As Workbook, strModule As String
    Application. ScreenUpdating = False
    Application. EnableEvents = False
        Set wbkSource = ThisWorkbook
            Set wbkTarget = Application. Workbooks("Original.xlsm")
            With wbkTarget. VBProject. VBComponents
                For Each varModule In Array("Module1", "Module2")
                    strModule = ThisWorkbook. Path & "\" & varModule & ".bas"
                    wbkSource. VBProject. VBComponents(varModule).Export Filename:=strModule
                    On Error Resume Next
                        .Remove VBComponent:=.Item(varModule)
                    On Error GoTo 0
                    .Import Filename:=ThisWorkbook. Path & "\" & varModule & ".bas"
                    Kill strModule
                Next varModule
            End With
    Application. EnableEvents = True
    Application. ScreenUpdating = True
End Sub

*** To Copy worksheets modules I have found this
Sub CopyWorksheetsModules()
    Dim src, dest, wb As Workbook, ws As Worksheet
    On Error Resume Next
        For Each ws In ThisWorkbook. Worksheets
            Set src = ThisWorkbook. VBProject. VBComponents(ws. CodeName).CodeModule
            Set wb = Workbooks("Original.xlsm")
            Set dest = wb. VBProject. VBComponents(ws. CodeName).CodeModule
            dest. DeleteLines 1, dest. CountOfLines
            dest. AddFromString src. Lines(1, src. CountOfLines)
        Next ws
    On Error GoTo 0
End Sub

A:

This is the code I use to import/export modules.  The export modules will delete all the current files in the folder holding them.  And the import modules will delete all the modules prior to the import.  Note that the:
ElseIf Not VBComp. Name Like "*Modulos*" Then
     VBProj. VBComponents. Remove VBComp
End If

Is to avoid the deletion of the modules handing the import/export.  They are called ImportarModulos and ExportarModulos so use a keyword to identify them and avoid both their deletion and import (because it may give you problems.) 
Export Module:
Option Explicit
Public Sub ExportModules()
    Dim bExport As Boolean
    Dim wkbSource As Excel. Workbook
    Dim szSourceWorkbook As String
    Dim szExportPath As String
    Dim szFileName As String
    Dim cmpComponent As VBIDE.VBComponent

    ''' The code modules will be exported in a folder named. 
    ''' VBAProjectFiles in the Documents folder. 
    ''' The code below create this folder if it not exist
    ''' or delete all files in the folder if it exist. 
    If FolderWithVBAProjectFiles = "Error" Then
        MsgBox "Export Folder not exist"
        Exit Sub
    End If

    On Error Resume Next
        Kill FolderWithVBAProjectFiles & "\*.*" 
    On Error GoTo 0

    ''' NOTE: This workbook must be open in Excel. 
    szSourceWorkbook = ActiveWorkbook. Name
    Set wkbSource = Application. Workbooks(szSourceWorkbook)

    If wkbSource. VBProject. Protection = 1 Then
    MsgBox "The VBA in this workbook is protected," & _
        "not possible to export the code"
    Exit Sub
    End If

    szExportPath = FolderWithVBAProjectFiles & "\"

    For Each cmpComponent In wkbSource. VBProject. VBComponents

        bExport = True
        szFileName = cmpComponent. Name

        ''' Concatenate the correct filename for export. 
        Select Case cmpComponent. Type
            Case vbext_ct_ClassModule
                szFileName = szFileName & ".cls"
            Case vbext_ct_MSForm
                szFileName = szFileName & ".frm"
            Case vbext_ct_StdModule
                szFileName = szFileName & ".bas"
            Case vbext_ct_Document
                ''' This is a worksheet or workbook object. 
                ''' Don't try to export. 
                bExport = False
        End Select
        If bExport Then
            ''' Export the component to a text file. 
            cmpComponent. Export szExportPath & szFileName
        ''' remove it from the project if you want
        '''wkbSource. VBProject. VBComponents. Remove cmpComponent
        End If
    Next cmpComponent

    Dim wb As Workbook, ws As Worksheet, LastRow As Long
    Set wb = Workbooks. Open("Z:\Planificacion-WFM\Planificacion Telefonica\Código\Log.xlsx")
    Set ws = wb. Sheets(1)
    LastRow = ws. Cells(ws. Rows. Count, 1).End(xlUp).Row + 1
    ws. Cells(LastRow, 1) = Application. UserName
    ws. Cells(LastRow, 2) = Format(Now(), "hh:mm:ss")
    ws. Cells(LastRow, 3) = Format(Now(), "dd/mm/yyyy")
    wb. Close Savechanges:=True

    MsgBox "Export is ready"
End Sub
Function FolderWithVBAProjectFiles() As String
    Dim WshShell As Object
    Dim FSO As Object
    Dim SpecialPath As String

    Set WshShell = CreateObject("WScript. Shell")
    Set FSO = CreateObject("scripting.filesystemobject")

    SpecialPath = "Z:\Planificacion-WFM\Planificacion Telefonica\Código"

    If Right(SpecialPath, 1) <> "\" Then
        SpecialPath = SpecialPath & "\"
    End If

    If FSO.FolderExists(SpecialPath & "VBAProjectFiles") = False Then
        On Error Resume Next
        MkDir SpecialPath & "VBAProjectFiles"
        On Error GoTo 0
    End If

    If FSO.FolderExists(SpecialPath & "VBAProjectFiles") = True Then
        FolderWithVBAProjectFiles = SpecialPath & "VBAProjectFiles"
    Else
        FolderWithVBAProjectFiles = "Error"
    End If

End Function

Import module:
Option Explicit
Public Sub ImportModules()
    Dim wkbTarget As Excel. Workbook
    Dim objFSO As Scripting. FileSystemObject
    Dim objFile As Scripting. File
    Dim szTargetWorkbook As String
    Dim szImportPath As String
    Dim szFileName As String
    Dim cmpComponents As VBIDE.VBComponents
'
'    If ActiveWorkbook. Name = ThisWorkbook. Name Then
'        MsgBox "Select another destination workbook" & _
'        "Not possible to import in this workbook "
'        Exit Sub
'    End If

    'Get the path to the folder with modules
    If FolderWithVBAProjectFiles = "Error" Then
        MsgBox "Import Folder not exist"
        Exit Sub
    End If

    ''' NOTE: This workbook must be open in Excel. 
    szTargetWorkbook = ActiveWorkbook. Name
    Set wkbTarget = Application. Workbooks(szTargetWorkbook)

    If wkbTarget. VBProject. Protection = 1 Then
    MsgBox "The VBA in this workbook is protected," & _
        "not possible to Import the code"
    Exit Sub
    End If

    ''' NOTE: Path where the code modules are located. 
    szImportPath = FolderWithVBAProjectFiles & "\"

    Set objFSO = New Scripting. FileSystemObject
    If objFSO.GetFolder(szImportPath).Files. Count = 0 Then
       MsgBox "There are no files to import"
       Exit Sub
    End If

    'Delete all modules/Userforms from the ActiveWorkbook
    Call DeleteVBAModulesAndUserForms

    Set cmpComponents = wkbTarget. VBProject. VBComponents

    ''' Import all the code modules in the specified path
    ''' to the ActiveWorkbook. 
    For Each objFile In objFSO.GetFolder(szImportPath).Files
        If objFile. Name Like "*Modulos*" Then GoTo Siguiente
        If (objFSO.GetExtensionName(objFile. Name) = "cls") Or _
            (objFSO.GetExtensionName(objFile. Name) = "frm") Or _
            (objFSO.GetExtensionName(objFile. Name) = "bas") Then
            cmpComponents. Import objFile. Path
        End If
Siguiente:
    Next objFile

    MsgBox "Módulos actualizados"
End Sub

Function DeleteVBAModulesAndUserForms()
        Dim VBProj As VBIDE.VBProject
        Dim VBComp As VBIDE.VBComponent

        Set VBProj = ActiveWorkbook. VBProject

        For Each VBComp In VBProj. VBComponents
            If VBComp. Type = vbext_ct_Document Then
                'Thisworkbook or worksheet module
                'We do nothing
            ElseIf Not VBComp. Name Like "*Modulos*" Then
                VBProj. VBComponents. Remove VBComp
            End If
        Next VBComp
End Function

