【问题标题】:Excel VBA Output to PDF Zoom %Excel VBA 输出到 PDF 缩放百分比
【发布时间】:2016-11-09 01:46:29
【问题描述】:

当通过宏打印 PDF 时,有没有办法控制其缩放百分比?我已将电子表格放大 100%,但 PDF 始终显示为 79.3%,而且很难看到。如果它放大到 200%,它在 PDF 上显示得非常好。我通常会忽略这方面,只是告诉用户放大,但这是给 CEO 的,你知道的。

这是我所拥有的:

Private Sub CommandButton1_Click()
Dim Sel_Manager As String
'Specify headers to be repeated at the top
Application.PrintCommunication = False
With ActiveSheet.PageSetup
        .PrintTitleRows = "$5:$10"
        .PrintTitleColumns = "$B:$M"
        .Orientation = xlLandscape
        .Zoom = False
        .FitToPagesWide = 1
        .FitToPagesTall = 1
End With

'Manager selection through simple Inputbox
 Sel_Manager = ComboBox1
'Insert autofilter for worksheet
Cells.Select
Selection.AutoFilter
'Select manager defined in inputbox
ActiveSheet.Range("B10", Range("M10").End(xlDown)).AutoFilter Field:=1, Criteria1:=Sel_Manager
ActiveSheet.Range("B10", Range("M10").End(xlDown)).AutoFilter Field:=2, Criteria1:="A"
 'Select range to be printed and specify manager in filename
ActiveSheet.Range("B10", Range("M10").End(xlDown)).Select

Selection.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
Sel_Manager + ".pdf", Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True

ActiveSheet.ShowAllData
Application.PrintCommunication = True
End Sub

【问题讨论】:

    标签: excel pdf vba


    【解决方案1】:

    在结束 sub 之前,请您将这些行添加到您的代码中。

    Application.PrintCommunication = False
        With ActiveSheet.PageSetup
            .Orientation = xlLandscape
            .Zoom = False
            '.PrintArea = Worksheets(ReportWsName).UsedRange
            .FitToPagesWide = 1
            '.FitToPagesTall = 1
        End With
    Application.PrintCommunication = True
    

    【讨论】:

    • 对于打印区域,它会根据自动过滤器自动调整,我该如何调整呢?感谢您迄今为止的帮助!
    猜你喜欢
    • 2015-07-30
    • 1970-01-01
    • 2019-01-14
    • 1970-01-01
    • 2013-08-25
    • 1970-01-01
    • 2013-06-24
    • 1970-01-01
    • 2021-10-17
    相关资源
    最近更新 更多