Export all modules to another workbook
'Use this code to export all modules from Personal.xlsb file to another workbook. Prior to running macro, open target workbook and change its name in the code accordingly.
Sub ExportImportModule()
For Each Module In Workbooks("Personal.xlsb").VBProject.VBComponents
If Module.name <> "ExportImportModule" Then
Module.Export ("c:\temp\" & Module.name & ".bas")
Workbooks("TargetWorkbook.xlsm").VBProject.VBComponents.Import ("c:\temp\" & Module.name & ".bas")
End If
Next Module
MsgBox "All objects (modules, forms and classes) were copied!"
End Sub
- Almir's blog
- Login or register to post comments
- 30467 reads
Recent comments
5 years 36 weeks ago
6 years 22 weeks ago
6 years 34 weeks ago
6 years 37 weeks ago
6 years 38 weeks ago
6 years 43 weeks ago
6 years 52 weeks ago
7 years 2 days ago
7 years 3 days ago
7 years 3 days ago