Option Explicit
Public Sub Export_Module()
Dim Item As Variant
Dim Sfx As String
For Each Item In ActiveWorkbook.VBProject.VBComponents
With Item
Select Case .Type
Case vbext_ct_ClassModule, vbext_ct_Document
Sfx = '.cls'
Case vbext_ct_MSForm
Sfx = '.frm'
Case vbext_ct_StdModule
Sfx = '.bas'
Case Else
Sfx = ''
End Select
If Sfx <> '' Then
.Export Filename:='C:\Chemin\' & .Name & Sfx
End If
End With
Next Item
End Sub