Importing Modules to the Global Template

T

tiro

Hi,

I've been stuck on this problem for a while. My main goal is to try to
import *.bas files into the Global Template. I am able to import into
the active project without a problem through the following code:

Dim Proj As MSProject.Application
Dim sFileName As String

sFileName = "C:\File.bas"
Proj = CreateObject("MSProject.Application")
Proj.Visible = True
Proj.FileOpen(Name:="C:\MSProjectFile.mpp", ReadOnly:=False)
Proj.ActiveProject.VBProject.VBComponents.Import(sFileName)

I have read that the ProjectGlobal (Global.MPT) is referenced as the
first VBProject. But I am unsure of the exact code to obtain an
instance to the object so that I can import the bas file into it.

I am using VB.NET (Not VBA to do this). Some sample code to do this
would be greatly appreciated!. TIA
 
T

tiro

I actually tried that code already, but VB.NET didn't like it, I get a
compilation error:

"Interface 'Microsoft.Vbe.Interop.VBProjects' cannot be indexed because
it has no default property."

Any ideas?
 

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