首页 > 解决方案 > 选定范围另存为 PDF

问题描述

例如,使用 Excel VBA,我想将 A1 和 J26 之间的区域保存为 pdf,但由于它不适合,它将 A1 保存到 E26。我应该如何通过在页面上安装来保存我选择的区域?我使用的代码如下。

With Sheets(1).Range("A1:J26")
   .ExportAsFixedFormat _
    Type:=xlTypePDF, _
    Filename:="C:\File_Name_Test.pdf", _
    Quality:=xlQualityStandard, _
    IncludeDocProperties:=True, _
    IgnorePrintAreas:=False, _
    OpenAfterPublish:=False '
End With

标签: excelvbapdf

解决方案


下面的代码看到了我的工作,谢谢

With Sheets("Sayfa1").PageSetup
.Orientation = xlPortrait
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
.PrintErrors = xlPrintErrorsDisplayed
.ScaleWithDocHeaderFooter = True
.AlignMarginsHeaderFooter = True
End With

With Sheets("Sayfa1").Range("A1:J22")
.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:="D:\_AppData_\Desktop\File_Name22.pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False '
End With

推荐阅读