Open,Save Projects in C#

N

Nach

Hello,
I have a couple of Questions about Opening projects..I'm using Project 2003
1. Is there a way to open MS Project Pro in C# without giving any
filename..? I'm able to open a project like this
System.Diagnostics.Process.Start("C:\\Project1.mpp");
But I'd want to just start the MS Project without giving any filename.

2. I know I can save projects in a macro in MS project like this
FileSave
But how do I save the project from C#..? I have added Project as a reference
to my code. But I do not see 'Save' as an option under Application or Project.

3. I have everything I want to do as a macro in Project. I'd like to call
that in my C# code...is there a way to do it ..?

Thanks!
Nachal.
 
N

Nach

Hi...I have answers to my questions

1. System.Diagnostics.ProcessStartInfo pi = new
System.Diagnostics.ProcessStartInfo();
pi.UseShellExecute = true;
pi.CreateNoWindow = true;
pi.FileName = "winproj.exe";

2. Add reference to MS Project in Visual Studio
Microsoft.Office.Interop.MSProject.Application msapp = new
Microsoft.Office.Interop.MSProject.Application();

msapp.FileOpen(); //I was unsuccessful in doing this. But this is the
syntax/method. I got errors in supplying parameters

msapp.FileSave();

3. msapp.Macro("Macro Name");
 
N

Nach

I missed one statement in first point. The complete set fo statements are

System.Diagnostics.ProcessStartInfo pi = new
System.Diagnostics.ProcessStartInfo();
pi.UseShellExecute = true;
pi.CreateNoWindow = true;
pi.FileName = "winproj.exe";

System.Diagnostics.Process.Start(pi);
 
V

Vicky

Hi,

I was able to implement your code successfully. However,
my requirement is a little different.

I have a bunch of templates. I want to deploy the templates on Project Server. I dont want to use PSI.

I want to deploy the templates using MS Project.

Please help me.

Thanks,
Vicky
 

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