' "Module_ImprtExportModules"
Option Explicit

Sub importModule()
  Dim tbModules()
  Dim sep$, chDir$, fichier$
  Dim nomMdule As String
  sep = Application.PathSeparator
  chDir = ThisWorkbook.Path & sep
  fichier = Dir(chDir)
  Do While Len(fichier) > 0
    If Right(fichier, 4) = ".bas" Then
      nomMdule = chDir & fichier
      With ActiveWorkbook.VBProject
        .VBComponents.Import nomMdule
      End With
    End If
    fichier = Dir
  Loop
End Sub


Sub ExportModules()
' Exporte les modules au format .bas
  Dim wbSource As Workbook
  Dim xvbap As Object, Module As Object
  Dim xFilePath$, nomClSource$
  
  xFilePath = "C:\Users\yal\Documents\tmp excel\Excel pratique\breizhinours\test\"
  nomClSource = ThisWorkbook.Name
  Set wbSource = Workbooks(nomClSource)
  Set xvbap = wbSource.VBProject
  For Each Module In wbSource.VBProject.VBComponents
'    If Module.Type = 1 Then
      Module.Export (xFilePath & Module.Name & ".bas")
'    End If
  Next Module

End Sub
