How to copy module form one workbook to another

  • Thread starter Thread starter deepakmehta
  • Start date Start date
D

deepakmehta

Hi,

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

Regards,
Deepak
 
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
 
Store your code as .bas files and use the procedures at Chip's site to import
them.
 
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
 

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

Back
Top