copy module across excel spreadsheets

G

Gargya

Hi ,

I was trying to copy one module from an excel spreadsheet to anothe
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 lik
to change the excel spreadsheet name dynamically , for example i wan
Workbooks("Data.xls") the "Data.xls" to be dynamic. Because I have
piece of macro which I want to copy across 100 other exce
spreadsheets.

Please guide me.

Thanks,
Gargya
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top