FileOpen Method

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)**

*expression   *     Optional. An expression that returns an Application object.

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 you're 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 with 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 isn't a database, UserID is ignored.

DatabasePassWord    Optional String. A password to use when accessing a database. If Name or FormatID isn't a database, DatabasePassWord is ignored.

format strings

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 will be prompted for the password.

IgnoreReadOnlyRecommended    Optional Boolean. True to prevent Project from displaying an alert that the project should be opened read-only. If the project wasn't saved with a read-only recommendation, IgnoreReadOnlyRecommended is ignored.

XMLName    Optional String. This is the XML DOM object that is passed in 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.

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. The 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"

Applies to | Application Object

See Also | ConsolidateProjects Method | DeleteFromDatabase Method | FileBuildID Method | FileClose Method | FileCloseAll Method | FileFormatID Method | FileLoadLast Method | FileNew Method | FileSave Method | FileSaveAs Method | FindFile Method | MacroSecurity Method | MapEdit Method | MapList Property | ODBCCreateDataSource Method | Quit Method