Accessing Project Object Model

Add-in Express™ Support Service
That's what is more important than anything else

Accessing Project Object Model
Converting VSTO to AddIn Express - reference issues 
Eric Sweet




Posts: 2
Joined: 2010-07-15
Hi,

I'm working to convert my existing VSTO add-in for MS Project to use Add-In Express, and in working through the errors generated, have found something I can't quite work out.

When the main form of the app loads, it creates some variables to hold active project name, project app version, and the active project. Like so:

Public projName As String = Globals.ThisAddIn.Application.ActiveProject.Name
Public projVersion As String = Globals.ThisAddIn.Application.Version

How do I access (or reference) these items now that I'm using Add-In Express?

Thanks,
Eric
Posted 15 Jul, 2010 08:58:51 Top
Andrei Smolin


Add-in Express team


Posts: 18823
Joined: 2006-05-11
Hi Eric,

If you have the MSProjectApp property in your add-in module, you can get the name of the activa document via MSProjectApp.ActiveProject.Name. As to the application version, you access it via MSProjectApp.Version. Also, the add-in module provides HostVersion and HostMajorVersion properties.


Andrei Smolin
Add-in Express Team Leader
Posted 15 Jul, 2010 09:30:52 Top
Eric Sweet




Posts: 2
Joined: 2010-07-15
Hi Andrei,

Thanks, but will that also work from a form launched by an Add-In Express button? In other words, outside the AddInModule itself?

When in the other form's code, if I type AddInModule.MSProjectApp.etc I can't access the Project object model. How do I do that?

Thanks,
Eric
Posted 15 Jul, 2010 09:43:02 Top
Andrei Smolin


Add-in Express team


Posts: 18823
Joined: 2006-05-11
Hi Eric,

In other classes you call:

CType(AddinExpress.MSO.ADXAddinModule.CurrentInstance, MyAddin1.AddinModule).MSProjectApp.etc


Andrei Smolin
Add-in Express Team Leader
Posted 15 Jul, 2010 09:56:06 Top