none
MSProject.Application FileSaveAs giving null reference exception RRS feed

  • Question

  • hi,

    I am using" Microsoft.Office.Interop.MSProject.Application" in MS office 2010 project proffesional.  but it is giving null reference exception.Actually i am trying to  publish my project .mpp to project server 2010 using FileSaveAs metnod.Below are my paramaters any thing elses i need to pass:

     projApp.Application.FileSaveAs(
                       "C:\Path.mpp",      // file name
                       Microsoft.Office.Interop.MSProject.PjFileFormat.pjMPP,  // format
                       Type.Missing,               // backup
                       Type.Missing,               // ReadOnly
                       true,              // TaskInformation
                       Type.Missing,               // Filtered
                       Type.Missing,                  // Table
                       Type.Missing,                  // UserID
                       Type.Missing,                  // DB Password
                       "",     // FormatID
                      Type.Missing,                  // Map
                       Type.Missing,                  // Password
                       Type.Missing,                  // Write Reserve Password
                       Type.Missing,               // Clear Baseline
                       Type.Missing,               // Clear Actuals
                      Type.Missing,               // Clear ResourceRates
                       Type.Missing);              // Clear FixedCosts


    Thanks & Regards, Krishna


    Monday, October 29, 2012 12:36 PM

All replies

  • What version of Windows are you running? I get the same problem in Windows 8.1.
    Thursday, October 17, 2013 2:15 PM
  • You say you are trying to publish to Project Server. SaveAs doesn't publish, a separate Publish method does that. Your code also has C:\Path.mpp as the File name so you are actually saving locally. Use "<>\Project name" to save to Project Server.

    Best tip when creating an Add-in is to get all code working in VBA first and then convert to C# or VB. Then you know all problems are VSTO related and nothing to do with the code. That does mean that's it's quicker to code in VB as VBA to VB conversion is much faster.


    Rod Gill

    The one and only Project VBA Book

    Rod Gill Project Management

    Thursday, October 17, 2013 7:39 PM
    Moderator