Application.FileOpen Method
Project Developer Reference |
Opens a project or imports data.
Syntax
expression.FileOpen(Name, ReadOnly, Merge, TaskInformation, Table, Sheet, NoAuto, UserID, DatabasePassWord, FormatID, Map, openPool, Password, WriteResPassword, IgnoreReadOnlyRecommended, XMLName, DoNotLoadFromEnterprise)
expression A variable that represents an Application object.
Parameters
Name | Required/Optional | Data Type | Description |
---|---|---|---|
Name | Optional | String | The name of the project file, source file, or data source to open. If Name is not specified, Project displays the Open dialog box. |
ReadOnly | Optional | Boolean | True if the file is opened read-only. If selectively importing data instead of loading a complete project, ReadOnly is ignored. |
Merge | Optional | Long | Specifies whether to automatically merge the file (MPX and XMLDOM formats only) with the active project. To automatically merge XLS, CSV, or TXT file formats, you can set the merge key in the import map that you are using. The Map argument should be used in place of Merge, which is included primarily for backward compatibility. If Map is specified, Merge is ignored. Can be one of the following PjMerge constants: pjDoNotMerge, pjMerge, pjAppend, or pjPrompt. The default value is pjDoNotMerge. |
TaskInformation | Optional | Boolean | True if the file contains information on tasks for a project saved under a non-Project file format. False if the file contains information on resources. 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. |
Table | Optional | String | The name of a table in which to place the resource or task information for a project saved under a non-Project file format. Table is required if the value of the Merge argument is pjMerge. 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 database file or format, Table is ignored. The default value for Table is the name of the active table. |
Sheet | Optional | String | The sheet to read when opening a workbook created in Microsoft Excel version 5.0 or later. The Map argument should be used in place of Sheet , which is included primarily for backward compatibility. If Map is specified, or if the file specified by Name is not a Microsoft Excel file, Sheet is ignored. |
NoAuto | Optional | Boolean | True if any Auto_Open macro is prevented from running. The default value is False. |
UserID | Optional | String | A user ID to use when accessing a database. If Name or FormatID is not a database, UserID is ignored. |
DatabasePassWord | Optional | String | A password to use when accessing a database. If Name or FormatID is not a database, DatabasePassWord is ignored. |
FormatID | Optional | String | String for the file or database format. If Project recognizes the format of the file specified with Name, FormatID is ignored. FormatID can be one of the following values.
Format StringDescription
"MSProject.mpp.9"Project file
"MSProject.mpt.9"Project template
"MSProject.mpd"Project database
"MSProject.mpw"Project workspace
"MSProject.mpx"Project 4.0 MPX file
"MSProject.odbc"ODBC database
"MSProject.mdb.9"Microsoft Access database
"MSProject.xls5.9"Microsoft Excel workbook
"MSProject.csv.9"CSV (comma-delimited) file
"MSProject.txt.9"TXT (tab-delimited) file
"MSProject.XMLDOM"XML file
|
Format String | Description | ||
"MSProject.mpp.9" | Project file | ||
"MSProject.mpt.9" | Project template | ||
"MSProject.mpd" | Project database | ||
"MSProject.mpw" | Project workspace | ||
"MSProject.mpx" | Project 4.0 MPX file | ||
"MSProject.odbc" | ODBC database | ||
"MSProject.mdb.9" | Microsoft Access database | ||
"MSProject.xls5.9" | Microsoft Excel workbook | ||
"MSProject.csv.9" | CSV (comma-delimited) file | ||
"MSProject.txt.9" | TXT (tab-delimited) file | ||
"MSProject.XMLDOM" | XML file | ||
Map | Optional | String | The name of the import/export map to use when importing data. |
openPool | Optional | Long | The action to take when opening a resource pool or sharer file. When opening a master project, the value for this argument is also applied to the subprojects. Can be one of the following PjPoolOpen constants: pjPromptPool, pjPoolReadOnly, pjPoolReadWrite, pjPoolAndShares, or pjDoNotOpenPool. The default value is pjPromptPool. |
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. |
IgnoreReadOnlyRecommended | Optional | BooleanVariant | True to prevent Project from displaying an alert that the project should be opened read-only. If the project was not saved with a read-only recommendation, IgnoreReadOnlyRecommended is ignored. |
XMLName | Optional | Variant | This is the XML DOM object that is passed to the function when the FormatID is MSProject.XMLDOM. The method should fail if this format is specified and XMLName is not a valid XML DOM Object. If the formatID is anything other than MSProject.XMLDOM, XMLName should be NULL and the method should fail otherwise. Only one of XMLName or Name may be specified, with the other one being NULL. |
DoNotLoadFromEnterprise | Optional | Variant |
Return Value
Boolean
Remarks
Using the FileOpen method without specifying any arguments displays the Open dialog box.
The Name argument can contain a file name string or an ODBC data source name (DSN) and project name string. The syntax for a data source is <DataSourceName>\Projectname. The less than (<) and greater than (>) symbols must be included, and a backslash ( \ ) must separate the data source name from the project name. DataSourceName itself can either be one of the ODBC data source names installed on the computer or a path and file name for a file-based database.
In the following examples, [My Documents] is the full path of your My Documents folder:
- "<Corporate SQL Database>\Factory Construction"
- "<[My Documents]\PROJECT1.MDB>\System Roll-out Plan"
See Also