Printing to PDF
Range("B2:O37").PrintOut
ActiveWorkbook.ExportAsFixedFormat
ActiveSheet.ExportAsFixedFormat _
Dim cht As Chart
Set cht = ws.ChartObjects("Chart 1").Chart
cht.ExportAsFixedFormat
Saving a Range as PDF
Private Sub Range_SaveAsPDF
Call Range.ExportAsFixedFormat( _
Type:=xlFixedFormatType.xlTypePDF, _
Filename:="C:\Temp\FileName", _
Quality:=xlFixedFormatQuality.xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True)
End Sub
Type - Can be either xlTypePDF or xlTypeXPS
Filename - 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 - Can be set to either xlQualityStandard or xlQualityMinimum.
IncludeDocProperties - Set to True to indicate that document properties should be included, or set to False to indicate that they are omitted.
IgnorePrintAreas - If set to True, ignores any print areas set when publishing. If set to False, uses the print areas set when publishing.
OpenAfterPublish - 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.
From - The number of the page at which to start publishing. If this argument is omitted, publishing starts at the beginning.
To - The number of the last page to publish. If this argument is omitted, publishing ends with the last page.
FixedFormatExtClassPtr - Pointer to the FixedFormatExt class.
© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext