Hi ,

I was trying to copy one module from an excel spreadsheet to another and searched google for information and found this piece of code:

With ThisWorkbook
FName = .Path & "\code.txt"
.VBProject.VBComponents("Module2").Export FName
End With

Workbooks("Data.xls").VBProject.VBComponents.Import FName
Kill FName
End Sub


I tried this piece and it works fine. The issue I have is I would like to change the excel spreadsheet name dynamically , for example i want Workbooks("Data.xls") the "Data.xls" to be dynamic. Because I have a piece of macro which I want to copy across 100 other excel spreadsheets.

Please guide me.

Thanks,
Gargya.