Pepys
Pepys

Reputation: 991

How to set 'Fit all columns on one page' in print tab

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

Upvotes: 25

Views: 81448

Answers (1)

user2140173
user2140173

Reputation:

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

Upvotes: 46

Related Questions