Condividi tramite


Application.FileSaveAs Method (Project)

Saves the active project to a new file name or exports data to a file.

Syntax

expression .FileSaveAs(Name, Format, Backup, ReadOnly, TaskInformation, Filtered, Table, UserID, DatabasePassWord, FormatID, Map, Password, WriteResPassword, ClearBaseline, ClearActuals, ClearResourceRates, ClearFixedCosts, XMLName, ClearConfirmed)

expression A variable that represents an Application object.

Parameters

Name

Required/Optional

Data Type

Description

Name

Optional

String

The name of a project file .

Format

Optional

PjFileFormat

Specifies the file format. The format of the file. The FormatID argument should be used in place of Format, which is included primarily for backwards compatibility. If FormatID is specified, Format is ignored. Can be one of the PjFileFormat constants. The default is pjMPP.

Backup

Optional

Boolean

True if Project creates a backup copy of the file. The default is False.

ReadOnly

Optional

Boolean

True if if Project should display an alert recommending that the file be opened read-only. If selectively exporting data instead of saving a complete project, ReadOnly is ignored. The default value is False.

TaskInformation

Optional

Boolean

True if task information is saved in a non-project file format. The Map argument should be used in place of TaskInformation, which is included primarily for backward compatibility. If Map is specified, TaskInformation is ignored. The default value is True if the active view is a task view; otherwise it is False.

Filtered

Optional

Boolean

True if filtered tasks or resources are saved, for a project saved in a non-Project file format. False if all the tasks or resources are saved. If Map is specified, Filtered is ignored. The default value is False.

Table

Optional

Variant

The name of the table containing resource or task information for a project saved in a non-Project file format. The Map argument should be used in place of Table, which is included primarily for backward compatibility. If Map is specified, or Name specifies a project file format, Table is ignored. The default value is the name of the active table.

UserID

Optional

String

Not used. Microsoft Project 2010 can open a project file that an earlier version of Project saved to an ODBC database, but cannot save to a database.

DatabasePassWord

Optional

String

Not used. Project 2010 cannot save to an ODBC database.

FormatID

Optional

String

Specifies the file format to use. If Project recognizes the format of the file specified with Name, FormatID is ignored. FormatID can be one of the following values for saving files:

Format String Description
"MSProject.mpp" Project file
"MSProject.mpt" Project template
"MSProject.mpp.8" Project 98 file
"MSProject.mpp.9" Project 2000 - 2003 file
"MSProject.mpp.12" Project 2007 file
"MSProject.xls" Microsoft Excel workbook
"MSProject.xls5" Microsoft Excel 97-2003 workbook
"MSProject.pdf" PDF file
"MSProject.xpf" XPF file
"MSProject.csv" CSV (Comma delimited) file
"MSProject.txt" TXT (Tab delimited) file
"MSProject.xml" Project XML file

Map

Optional

String

The name of the import/export map to use when exporting data.

Password

Optional

String

A password to use when opening password-protected project files. If Password is incorrect or omitted and a file requires a password, the user is prompted for the password.

WriteResPassword

Optional

String

A password to use when writing to a write-reserved project file. If WriteResPassword is omitted and the file requires a password, the user is prompted for the password.

ClearBaseline

Optional

Boolean

True if baseline values (the Baseline Cost, Baseline Work, Baseline Start, Baseline Finish, Baseline Duration, Timephased Baseline Work, and Timephased Baseline Cost fields) are cleared when saving as a template. The default value is False.

ClearActuals

Optional

Boolean

True if actual values (the % Complete field and, if actual costs are not calculated by Project, the Actual Cost field) are cleared when saving as a template. The default value is False.

ClearResourceRates

Optional

Boolean

True if resource rate tables are cleared when saving as a template. The default value is False.

ClearFixedCosts

Optional

Boolean

True if the Fixed Costs field is cleared for all tasks when saving as a template. The default value is False.

XMLName

Optional

Variant

This is the XML DOM object that is passed to the function when the FormatID is MSProject.XML. The FileSaveAs method fails if the XML format is specified and XMLName is not a valid XML DOM object. If the formatID is anything other than MSProject.XML, XMLName should be NULL and the method should fail otherwise. Only one of XMLName or Name can be specified.

ClearConfirmed

Optional

Boolean

True if the information is cleared about whether tasks have been confirmed as published to Project Server. The default value is False.

Return Value

Boolean

Remarks

Using the value "MSProject.mpp.9" for the FormatID parameter causes Project to show the Saving to Previous Version - Compatibility Checker dialog box. For example, manually scheduled tasks will be converted to automatically scheduled tasks in previous Project versions. You can choose to keep the format or cancel the save operation. You can also check Don't tell me about this again .

Note

Several FormatID strings are obsolete; if you try to use them, they result in run-time error 1004. FormatID values such as "MSProject.odbc" can be used in Project 2003 and earlier versions but are removed in Project 2007 and later versions.