MSProject.Application.FileSaveAs and XML

D

Davey P

I have created an add-in for MS Project 2007 using C# (.NET 2.0). One of the
features is to prompt for a filename using a SaveFileDialog, and then
automatically call the Application.FileSaveAs method and save the file as an
XML file. I cannot get this to work at all. The code doesn't exception, but
it doesn't create anything either.

System.Xml.XmlDocument XmlDoc = new System.Xml.XmlDocument();

FileSaveAs(saveFileDialog1.FileName,
Microsoft.Office.Interop.MSProject.PjFileFormat.pjMPP,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,"MSProject.XMLDOM",Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing);

You have to specify a pjFileFormat and XML isn't in the list, so I just set
it to pjMPP.

Any help would be greatly appreciated
 
R

Rod Gill

HI,

Recording a VBA macro in Project I get:

FileSaveAs Name:="C:\Delete me.xml", FormatID:="MSProject.XML"

So I suspect that if xml isn't a format option in C# that there is a problem
with the interface. Saving with type mpp is unlikely to work.
--

Rod Gill
Microsoft MVP for Project

Author of the only book on Project VBA, see:
http://www.projectvbabook.com
 

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