Workbook.ExportAsFixedFormat method (Excel)
The ExportAsFixedFormat method is used to publish a workbook to either the PDF or XPS format.
Syntax
expression.ExportAsFixedFormat (Type, FileName, Quality, IncludeDocProperties, IgnorePrintAreas, From, To, OpenAfterPublish, FixedFormatExtClassPtr)
expression A variable that represents a Workbook object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
Type | Required | XlFixedFormatType | Can be either xlTypePDF or xlTypeXPS. |
FileName | Optional | Variant | A string that indicates the name of the file to be saved. You can include a full path, or Excel saves the file in the current folder. |
Quality | Optional | Variant | Can be set to either of the following XlFixedFormatQuality constants: xlQualityStandard or xlQualityMinimum. |
IncludeDocProperties | Optional | Variant | Set to True to indicate that document properties should be included, or set to False to indicate that they are omitted. |
IgnorePrintAreas | Optional | Variant | If set to True, ignores any print areas set when publishing. If set to False, uses the print areas set when publishing. |
From | Optional | Variant | The number of the page at which to start publishing. If this argument is omitted, publishing starts at the beginning. |
To | Optional | Variant | The number of the last page to publish. If this argument is omitted, publishing ends with the last page. |
OpenAfterPublish | Optional | Variant | If set to True, displays the file in the viewer after it is published. If set to False, the file is published but not displayed. |
FixedFormatExtClassPtr | Optional | Variant | Pointer to the FixedFormatExt class. |
Example
The following example creates the PDF at standard quality in the current file's directory and displays the file in the viewer after it is published. An error occurs if the PDF add-in is not currently installed.
ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF FileName:="sales.pdf" Quality:=xlQualityStandard OpenAfterPublish:=True
See also
Manage sensitivity labels in Office apps
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.
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기