Document.ExportAsFixedFormat Method

Visio Automation Reference

Exports a Microsoft Office Visio document as a file in a fixed format, either PDF or XPS.

Version Information
Version Added: Visio 2007

Syntax

expression.ExportAsFixedFormat(FixedFormat, OutputFileName, Intent, PrintRange, FromPage, ToPage, ColorAsBlack, IncludeBackground, IncludeDocumentProperties, IncludeStructureTags, UseISO19005_1, FixedFormatExtClass)

expression An expression that returns a Document object.

Parameters

Name Required/Optional Data Type Description
FixedFormat Required VisFixedFormatTypes The format type in which to export the document. See Remarks for possible values.
OutputFileName Optional String The name and path of the file to which to output, enclosed in quotation marks.
Intent Required VisDocExIntent The output quality. See Remarks for possible values.
PrintRange Required VisPrintOutRange The range of document pages to be exported. See Remarks for possible values.
FromPage Optional Long If PrintRange is visPrintFromTo , the first page in the range to be exported. The default is 1, which indicates the first page of the drawing.
ToPage Optional Long If PrintRange is visPrintFromTo , the last page in the range to be exported. The default is -1, which indicates the last page of the drawing.
ColorAsBlack Optional Boolean True to render all colors as black to ensure that all shapes are visible in the exported drawing. False to render colors normally. The default is False.
IncludeBackground Optional Boolean Whether to include background pages in the exported file. The default is True.
IncludeDocumentProperties Optional Boolean Whether to include document properties in the exported file. The default is True.
IncludeStructureTags Optional Boolean Whether to include document structure tags to improve document accessibility. The default is True.
UseISO19005_1 Optional Boolean Whether the resulting document is compliant with ISO 19005-1 (PDF/A). The default is False.
FixedFormatExtClass Optional [UNKNOWN] A pointer to a class that implements the IMsoDocExporter interface for purposes of creating custom fixed output. The default is a null pointer.

Return Value
Nothing

Remarks

The ExportAsFixedFormat method is the equivalent of the Publish As PDF or XPS command on the File menu in the Visio user interface. The method creates a file that contains a static view of the Visio document.

ms409271.vs_note(en-us,office.12).gif Note
You can save as a PDF or XPS file from a 2007 Microsoft Office system program only after you install an add-in. For more information, search for "Enable support for other file formats, such as PDF and XPS" on Office Online.

Possible values for the FixedFormat parameter are shown in the following table and declared in VisFixedFormatTypes in the Visio type library.

Constant Value Description

visFixedFormatPDF

1

PDF fixed format

visFixedFormatXPS

2

XPS fixed format

Possible values for the Intent parameter are shown in the following table and declared in VisDocExIntent in the Visio type library.

Constant Value Description

visDocExIntentPrint

1

Intended to be published online and printed

visDocExIntentScreen

0

Intended to be published only online

Possible values for the PrintRange parameter are shown in the following table and declared in VisPrintOutRange in the Visio type library.

Constant Value Description

visPrintAll

0

Prints all foreground pages.

visPrintCurrentPage

2

Prints the active page.

visPrintCurrentView

4

Prints the current view area.

visPrintFromTo

1

Prints pages between the FromPage value and the ToPage value.

visPrintSelection

3

Prints a selection.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the ExportAsFixedFormat method to export the active Visio document to the root of the C drive in PDF format.

Visual Basic for Applications
  Public Sub ExportAsFixedFormat_Example()

    ActiveDocument.ExportAsFixedFormat visFixedFormatPDF, "C:\ExportedVisioDocument.pdf", visDocExIntentPrint, visPrintAll

End Sub

See Also