Excel VBA输出到PDF缩放%

时间:2016-11-09 01:46:29

标签: excel-vba pdf vba excel

通过宏打印时,有没有办法控制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

1 个答案:

答案 0 :(得分: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