add programmatically a module class from a file in a VB project

H

Herve cadieu

Hi all
I would like that my template.dot which creates a new document
within a vbproj(document1) can add a module class within the new document
programmatically from file "c:\theclass.cls"

I cannot figure out the appropriate code , can someone help me ?

'Sub AddModuleClassinMyproject( classname,path)
Dim v As Integer
v=
activedocument.VBProject.VBE.ActiveVBProject.VBE.CodePanes.item.VBE.CodePanes.count
activedocument.VBProject.VBE.ActiveVBProject.VBE.CodePanes.item(v).
..CodeModule.AddFromFile path+className'

activedocument.VBProject.VBComponents("EventClassmodule").CodeModule.AddFromFile path+className
'
'End Sub
 

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

Top