How to set 'Fit all columns on one page' i

2019-04-03 19:05发布

The only thing I would want is to always set the 'Fit all columns on one page' setting when users open the Print tab in Excel.

And no, they don't want to do it themselves. What a surprise :)

Here is a screenshot of where that is in Excel 2013:enter image description here

Tried to look for some VBA code like the following but without success.

With Sheets("Print Letter").PageSetup .FitToPagesWide = 1 .FitToPagesTall = 1 End With

1条回答
女痞
2楼-- · 2019-04-03 19:15

Try setting the .FitToPagesTall to False to be able to manually set the .FitToPagesWide property.

MSDN link

If this property is False, Microsoft Excel scales the worksheet according to the FitToPagesWide property. If the Zoom property is True, the FitToPagesTall property is ignored.

Sub PrintColumns()
    Application.PrintCommunication = False
    With Sheets("Print Letter").PageSetup
        .FitToPagesWide = 1
        .FitToPagesTall = False
    End With
    Application.PrintCommunication = True
End Sub
查看更多
登录 后发表回答