see good examples for doing a variety of work in this area here:
http://www.cpearson.com/excel/vbe.htm
--
Regards,
Tom Ogilvy
"Miri" wrote:
>
> 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.
>
> --
> Miri Tz.