Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 441
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 441
Default 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.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
code in module A to not execute a Worksheet_SelectionChange sub of another module Jack Sons Excel Discussion (Misc queries) 4 December 11th 05 11:52 PM
copying vba code to a standard code module 1vagrowr Excel Discussion (Misc queries) 2 November 23rd 05 04:00 PM
Sheet Code Module: copying code to [email protected][_2_] Excel Programming 2 December 14th 04 01:57 AM
Copy module with code - amendment Stuart[_5_] Excel Programming 2 November 1st 04 07:40 AM
Is it possible to copy a code module using VBA? quartz Excel Programming 2 April 15th 04 09:49 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"