copy Module via macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi,
i need to add a module via macro.
what i did before is adding a new module, define the name and added the code
as string... as you can see below:
Set xlModule = Application.VBE.ActiveVBProject.VBComponents.Add(1)
xlModule.Name = "SetConfigTo" & config & "_"
Code = "Sub SetConfigTo" & config & "()" & vbCr & " ...& "End Sub"
xlModule.codemodule.addfromstring Code

now i need to copy module from other project. the code is about 1000 lines.
do you know a better way to do that?
thanks.
 

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