ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   copy module across excel spreadsheets (https://www.excelbanter.com/excel-programming/338215-copy-module-across-excel-spreadsheets.html)

Gargya

copy module across excel spreadsheets
 

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.Impor t 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

--
Gargy
-----------------------------------------------------------------------
Gargya's Profile: http://www.excelforum.com/member.php...fo&userid=2659
View this thread: http://www.excelforum.com/showthread.php?threadid=39871



All times are GMT +1. The time now is 07:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com