ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy a code module (https://www.excelbanter.com/excel-programming/327234-copy-code-module.html)

quartz[_2_]

Copy a code module
 
I am using Excel 2003 with Windows XP.

Is there a way to copy code module (not just the code, but the entire
module) and paste it into a specific destination file?

If so could someone please paste example code illustrating how to do this?

Thanks much in advance.

Chip Pearson

Copy a code module
 
You first need to export it out of the source project, and import
it in to the destination project. Something like the following
should work:

ThisWorkbook.VBProject.VBComponents("Module1").Exp ort _
Filename:="C:\Module1.bas"
Workbooks("Book4.xls").VBProject.VBComponents.Impo rt _
Filename:="C:\Module1.bas"

See www.cpearson.com/excel/vbe.htm for more details and example
code.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"quartz" wrote in message
...
I am using Excel 2003 with Windows XP.

Is there a way to copy code module (not just the code, but the
entire
module) and paste it into a specific destination file?

If so could someone please paste example code illustrating how
to do this?

Thanks much in advance.




quartz[_2_]

Copy a code module
 
Thanks Chip and regards.

Quartz

"Chip Pearson" wrote:

You first need to export it out of the source project, and import
it in to the destination project. Something like the following
should work:

ThisWorkbook.VBProject.VBComponents("Module1").Exp ort _
Filename:="C:\Module1.bas"
Workbooks("Book4.xls").VBProject.VBComponents.Impo rt _
Filename:="C:\Module1.bas"

See www.cpearson.com/excel/vbe.htm for more details and example
code.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"quartz" wrote in message
...
I am using Excel 2003 with Windows XP.

Is there a way to copy code module (not just the code, but the
entire
module) and paste it into a specific destination file?

If so could someone please paste example code illustrating how
to do this?

Thanks much in advance.






All times are GMT +1. The time now is 01:36 AM.

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