Partager via


Add Method

Adds a file to a project.

Object.Add(cFileName)

Return Values

Object

Parameters

  • cFileName
    Specifies the name of the file to add to the project. An error is generated if the file you specify does not exist. The Project Manager window, if open, is refreshed after the file has been added.

Remarks

The Add method is a method for the files collection. When a file is added to a project with the Add method, a File object is created for the file, and the File object is added to the Files collection.

An object reference to the newly added file is returned if the file is successfully added to the project. The null value is returned if the file can't be added to the project.

The QueryAddFile event occurs just before a file is added to a project. If NODEFAULT is specified in the QueryAddFile event, the file isn't added to the project.

Include NODEFAULT in the QueryAddFile event to prevent a file from being added to the project.

See Also

File Object | QueryAddFile Event

Applies To: Files Collection