Application.DocumentExport method (Project)

Exports the active project as a document in PDF or XPS format.

Syntax

expression. DocumentExport( _FileName_, _FileType_, _IncludeDocumentProperties_, _IncludeDocumentMarkup_, _ArchiveFormat_, _FromDate_, _ToDate_ )

expression An expression that returns an Application object.

Parameters

Name Required/Optional Data type Description
FileName Optional String Specifies the file name of the exported document. The default value is the name of the active project as a PDF file.
FileType Optional PjDocExportType Specifies whether to export the project as a PDF or an XPS document. The default value is pjPDF (0).
IncludeDocumentProperties Optional Variant If True or 1, the last page of the exported document includes some document properties. The default value is True.
IncludeDocumentMarkup Optional Variant If True or 1, the last page of the exported document includes a legend of the symbols shown in the view. The default is True.
ArchiveFormat Optional Variant If True or 1, exports a PDF document in the ISO 19500-1 compliant (PDF/A) format. The default value is False.
FromDate Optional Variant The start date of the range of dates to publish. The default value is the project start date.
ToDate Optional Variant The end date of the range of dates to publish. The default value is the project end date.

Return value

Boolean

Remarks

Running the DocumentExport method without any parameters brings up the Browse dialog box and the name of the active project as a PDF file. If the user cancels the Browse or the subsequent Document Export Options dialog box, DocumentExport returns False.

To export a custom format PDF or XPS document, where you can use a pointer to a class in an add-in, see ExportAsFixedFormat.

Example

If the active project shows a Network Diagram view, the following example creates an XPS document named TestProject.xps. When you open the file in the XPS Viewer application, the last page includes document properties and a legend that shows the PERT chart symbols.

DocumentExport FileName:="TestProject.xps", FileType:=pjXPS

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.