C# and Application.FileSaveAs

B

Brian Leach

I'm trying to tell Project to "save as" from my C# program, and I almost
have it working, but not quite . . .

When I try it this way:

project.Application.FileSaveAs(
"c:\\test.mpp", // file name
PjFileFormat.pjMPP, // format
false, // backup
false, // ReadOnly
true, // TaskInformation
false, // Filtered
"", // Table
"", // UserID
"", // DB Password
"MSProject.mpp", // FormatID
"", // Map
"", // Password
"", // Write Reserve Password
false, // Clear Baseline
false, // Clear Actuals
false, // Clear ResourceRates
false); // Clear FixedCosts

Project complains that "the map with the specified name does not exist." If
I replace the empty string with null on the Map parameter, Project doesn't
complain, but it doesn't save the file either.

Any ideas what I'm doing wrong (besides not using VBA)?

/brian leach
 
R

Rod Gill

Or besides not using VB?!!

I thought there was a C# null parameter you could use? Try searching
msdn.microsoft.com for sample code to control Office applications.

--

Rod Gill
Project MVP

NEW!! Project VBA Book, for details visit: http://www.projectvbabook.com
 
B

Brian Leach

I got it working by using the Type.Missing parameter on EVERY field except
name, format, and formatID. Apparently it was something else besides Map
that was causing the problem.

Thanks!
 
R

Rod Gill

Anyone who calls my book excellent is obviously a scholar, a gentleman and a
great judge of whiskey (and truthful)!!!

Good luck.

--

Rod Gill
Project MVP

NEW!! Project VBA Book, for details visit: 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