Reputation: 113
With ActiveSheet.PageSetup
.PrintArea = Cells(1, 1).Resize(LR, 16).Address
.Orientation = xlLandscape
.LeftMargin = Application.InchesToPoints(0.2)
.RightMargin = Application.InchesToPoints(0.2)
.TopMargin = Application.InchesToPoints(0.5)
.BottomMargin = Application.InchesToPoints(0.5)
.FitToPagesWide = True
.FitToPagesTall = False
End With
All properties are accepted except .FitToPagesWide
I get RT1004 - Unable to set property of the PageSetup class ONLY for this parameter.
All other properties are set correctly and operate as expected when I actually print the sheet. I have another program that uses the same code block, and it works properly on several computers.
Upvotes: 3
Views: 5603
Reputation: 53
Also, make sure you have selected default printer. If you have no printer selected, you will also get an error.
Upvotes: 3
Reputation: 113
Add:
Application.PrintCommunication = False
before setting the print parameters, then
Application.PrintCommunication = True
after they're finished. This prevents the error, and the print area is properly set and properly prints when tested - with the area fit to page width of whatever printer you use.
Upvotes: 5