![]() |
Print Macro Problem
I am pulling what is left of my hair out with this one. The Procedure below
is set up to print out a dynamic range which it does fine but it refuses to restict the size to one page wide. I have an almost identical procedure elsewhere and it works fine and I have copied it and just changed the named print area but it still refuses to do it. Any help would be most appreciated. Sub printpkmanureplanner() If Range("a5").Value = "" Then MsgBox "There are no fields to print. Operation cancelled", vbInformation, "Print Cancelled" Exit Sub End If ActiveSheet.PageSetup.PrintArea = "AAPKPlannedCrops" With ActiveSheet.PageSetup .PrintTitleRows = "$1:$4" .Orientation = xlLandscape .PaperSize = xlPaperA4 .FitToPagesWide = 1 .FitToPagesTall = 20 .LeftFooter = "&F" End With ActiveWindow.SelectedSheets.PrintOut End Sub Graham Haughs Turriff Scotland |
Print Macro Problem
I would think that by setting the .fittopageswide to 1, that you would want the
..fittopagestall to be whatever it needed--not 20. I'd use: .Zoom = False .FitToPagesWide = 1 .FitToPagesTall = False (.zoom is important) Graham Haughs wrote: I am pulling what is left of my hair out with this one. The Procedure below is set up to print out a dynamic range which it does fine but it refuses to restict the size to one page wide. I have an almost identical procedure elsewhere and it works fine and I have copied it and just changed the named print area but it still refuses to do it. Any help would be most appreciated. Sub printpkmanureplanner() If Range("a5").Value = "" Then MsgBox "There are no fields to print. Operation cancelled", vbInformation, "Print Cancelled" Exit Sub End If ActiveSheet.PageSetup.PrintArea = "AAPKPlannedCrops" With ActiveSheet.PageSetup .PrintTitleRows = "$1:$4" .Orientation = xlLandscape .PaperSize = xlPaperA4 .FitToPagesWide = 1 .FitToPagesTall = 20 .LeftFooter = "&F" End With ActiveWindow.SelectedSheets.PrintOut End Sub Graham Haughs Turriff Scotland -- Dave Peterson |
Print Macro Problem
Many thanks Dave, that has done the trick perfectly. The zoom seemed to
be the missing link. Graham Dave Peterson wrote: I would think that by setting the .fittopageswide to 1, that you would want the .fittopagestall to be whatever it needed--not 20. I'd use: .Zoom = False .FitToPagesWide = 1 .FitToPagesTall = False (.zoom is important) Graham Haughs wrote: I am pulling what is left of my hair out with this one. The Procedure below is set up to print out a dynamic range which it does fine but it refuses to restict the size to one page wide. I have an almost identical procedure elsewhere and it works fine and I have copied it and just changed the named print area but it still refuses to do it. Any help would be most appreciated. Sub printpkmanureplanner() If Range("a5").Value = "" Then MsgBox "There are no fields to print. Operation cancelled", vbInformation, "Print Cancelled" Exit Sub End If ActiveSheet.PageSetup.PrintArea = "AAPKPlannedCrops" With ActiveSheet.PageSetup .PrintTitleRows = "$1:$4" .Orientation = xlLandscape .PaperSize = xlPaperA4 .FitToPagesWide = 1 .FitToPagesTall = 20 .LeftFooter = "&F" End With ActiveWindow.SelectedSheets.PrintOut End Sub Graham Haughs Turriff Scotland |
All times are GMT +1. The time now is 11:13 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com