![]() |
Importing modules from a folder
Chip Pearson's website has great code for copying modules between
projects, but can anyone tell me how to tweak the code so that I can copy modules from a folder or directory. Here is the code for the unenlightened: Sub CopyAllModules() Dim FName As String Dim VBComp As VBIDE.VBComponent With Workbooks("Book2") FName = .Path & "\code.txt" If Dir(FName) < "" Then Kill FName End If For Each VBComp In .VBProject.VBComponents If VBComp.Type < vbext_ct_Document Then VBComp.Export FName Workbooks("book1").VBProject.VBComponents.Import FName Kill FName End If Next VBComp End With End Sub I'm guessing I need to change the first line, "With Workbooks...", but I don't know the syntax to fix it. Thanks to all. |
All times are GMT +1. The time now is 03:10 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com