Save as PDF in Landscape

扶醉桌前 提交于 2020-01-11 08:59:08

问题


How can I pdf multiple sheets in my Workbook into one pdf in landscape format? Here is what I have. I am missing the landscape syntax -

Sub CompileReport()

    Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select

    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="F:\Report\Test" & ".pdf", _
    Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False


End Sub

Thanks!


回答1:


Try this one:

Sub CompileReport()
    Dim mySheets As Variant, sh

    mySheets = Array("Sheet1", "Sheet2", "Sheet3")
    For Each sh In mySheets
        Sheets(sh).PageSetup.Orientation = xlLandscape
    Next

    Sheets(mySheets).Select
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="F:\Report\Test" & ".pdf", _
        Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False
End Sub


来源:https://stackoverflow.com/questions/23118877/save-as-pdf-in-landscape

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!