How to Convert a workbook/worksheet to PDF

Source: Internet
Author: User

How to save Workbook/worksheet as a PDF, which is mostly used with the ExportasfixedformaT method, to convert workbook, Sheet, Chart, or range to PDF or XPS format

1 Subconvertsheettopdf ()2 DimFileName as String3FileName = Application.getsaveasfilename (initialfilename:="", filefilter:="PDF Files (*.pdf), *.pdf", title:="Select Path and FileName to save")4 IfFileName <>"False"  Then5   withActiveWorkbook6. Worksheets ("Sheet1"). ExportAsFixedFormat Type:=xltypepdf, filename:= _7FileName, Quality:=xlqualitystandard, includedocproperties:=True, ignoreprintareas:=False, openafterpublish:=False8  End  with9 End IfTen End Sub

The parameters and descriptions are described in more detail on MSDN:

Name

Required/Optional

Data type

Description

Type

Necessary

Xlfixedformattype

It can be xltypepdf or xltypexps.

Filename

Options available

Variant

A string that indicates the name of the file to save. You can include the full path, or Excel will save the file in the current folder.

Quality

Options available

Variant

Can be set to Xlqualitystandard or xlqualityminimum.

Includedocproperties

Options available

Variant

Set to True to indicate that document properties should be included, or set to False to indicate that document properties should be omitted.

Ignoreprintareas

Options available

Variant

If set to True, any print areas that are set at publish time are ignored. If set to False, the print area that is set when publishing is used.

From

Options available

Variant

The starting page number of the publication. If this argument is omitted, the publication starts at the starting position.

To

Options available

Variant

The ending page number of the publication. If this argument is omitted, it is published to the last page.

Openafterpublish

Options available

Variant

If set to True , the file is displayed in the viewer after publishing. If set to False , the file is published but not displayed.

Fixedformatextclassptr

Options available

Variant

A pointer to the Fixedformatext class.

How to Convert a workbook/worksheet to PDF

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.