ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to copy module form one workbook to another (https://www.excelbanter.com/excel-programming/360850-how-copy-module-form-one-workbook-another.html)

deepakmehta[_7_]

How to copy module form one workbook to another
 

Hi,

How do i copy modules form one workbook to another through vba.

Regards,
Deepak


--
deepakmehta
------------------------------------------------------------------------
deepakmehta's Profile: http://www.excelforum.com/member.php...o&userid=29609
View this thread: http://www.excelforum.com/showthread...hreadid=539876


Dave Peterson

How to copy module form one workbook to another
 
Check out Chip Pearson's site:
http://cpearson.com/excel/vbe.htm

deepakmehta wrote:

Hi,

How do i copy modules form one workbook to another through vba.

Regards,
Deepak

--
deepakmehta
------------------------------------------------------------------------
deepakmehta's Profile: http://www.excelforum.com/member.php...o&userid=29609
View this thread: http://www.excelforum.com/showthread...hreadid=539876


--

Dave Peterson

deepakmehta[_8_]

How to copy module form one workbook to another
 

I have tried that but i am still unsuccessful...... help !!

What i am doing is making a xl. file thrugh vba code in Main.xl and
then saving it as User.xl, now i need to copy one of the modules form
the Main.xl to the User.xl.


Regards,
Deepak


--
deepakmehta
------------------------------------------------------------------------
deepakmehta's Profile: http://www.excelforum.com/member.php...o&userid=29609
View this thread: http://www.excelforum.com/showthread...hreadid=539876


Dave Peterson

How to copy module form one workbook to another
 
Store your code as .bas files and use the procedures at Chip's site to import
them.

deepakmehta wrote:

I have tried that but i am still unsuccessful...... help !!

What i am doing is making a xl. file thrugh vba code in Main.xl and
then saving it as User.xl, now i need to copy one of the modules form
the Main.xl to the User.xl.

Regards,
Deepak

--
deepakmehta
------------------------------------------------------------------------
deepakmehta's Profile: http://www.excelforum.com/member.php...o&userid=29609
View this thread: http://www.excelforum.com/showthread...hreadid=539876


--

Dave Peterson

David

How to copy module form one workbook to another
 
deepakmehta wrote

What i am doing is making a xl. file thrugh vba code in Main.xl and
then saving it as User.xl, now i need to copy one of the modules form
the Main.xl to the User.xl.


Study the code on that site that looks like this:
With ThisWorkbook
FName = .Path & "\code.txt"
..VBProject.VBComponents("Module2").Export FName
End With
ActiveWorkbook.VBProject.VBComponents.Import FName
Kill FName


--
David


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

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