VSTO MS Project object error in C# code

M

Memphis Monroe

Hi all
I'm using Visual Studio 2008 and Project Professional 2007.
When try to create project at runtime using VSTO and C#

I'm getting the following error

"Retrieving the COM class factory for component with CLSID
{1019A320-508A-11CF-A49D-00AA00574C74} failed due to the following error:
80040154."

Here is the code
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
SProject.Project mpro = new Microsoft.Office.Interop.MSProject.Project();
mpro.Name = "Do It!";
mpro.Tasks.Add("do what i say!", "Jun 2010");
}
 
J

Jack Dahlgren

The arguments to Tasks.Add are not correct.
The second argument should be a long, not a string.
Give it the index of the task you want to add it after.

-Jack Dahlgren
 
M

Memphis Monroe

Error:
Object reference not set to an instance of an object.

for this line > mpro.Name = "Do It!";
 

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