Y.op
Y.op

Reputation: 79

MS Project get name current project

For my project, i need to get the name of my current active document file of my ms project. But i can't find the function for get the file name...

someone know how te get the file name ?

I Use this :

Microsoft.Office.Interop.MSProject;

Upvotes: 0

Views: 536

Answers (1)

Jerred S.
Jerred S.

Reputation: 376

From my VSTO add-in named thisAddIn, I accessed the project file information with this little example function (activated by a ribbon button)

    private void showFileAndPath_Click(object sender, RibbonControlEventArgs e)
    {

        var name = Globals.ThisAddIn.Application.ActiveProject.Name;
        var path = Globals.ThisAddIn.Application.ActiveProject.Path;
        var fullName = Globals.ThisAddIn.Application.ActiveProject.FullName;

        System.Windows.Forms.MessageBox.Show(
            "name: " + name + Environment.NewLine + 
            "path: " + path + Environment.NewLine + 
            "fullName: " + fullName);
    }

Upvotes: 2

Related Questions