ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to Maximize Print Size (https://www.excelbanter.com/excel-programming/343976-how-maximize-print-size.html)

John Michl

How to Maximize Print Size
 
I need to adjust the zoom settings on Page Setup to fill up the printed
page. (The reverse of condensing the page to fit on one page.)

Any ideas on how to do this with VBA? Manually playing with the zoom
settings isn't an option. I've created a mini-crossword app and the
print range changes based on the size of the puzzle. I don't want the
user to have to adjust the settings.

Since I've calculated the print range in VBA, I would assume that I
could calculate the combined width of the columns and length of the
rows. Could this be converted to something that would determine how
much of the page would be filled then adjust zoom accordingly?

Thanks for the ideas and any sample code.

- John


tiah

How to Maximize Print Size
 
Hello

Here how I would do it in VBA, but maybe there is a better manner
Mine is to put the zoom at minimum and count page, if it is still 1, it
will continues to add zoom until page count is 2


Sub FitToPage()
Application.ScreenUpdating = False
For i = 10 To 400
ActiveSheet.PageSetup.Zoom = i
numPages = ExecuteExcel4Macro("Get.Document(50)")
If numPages 1 Then
ActiveSheet.PageSetup.Zoom = i - 1
Exit For
End If
Next
End Sub


John Michl

How to Maximize Print Size
 
Great idea. Much simpler than what I was thinking.

Thanks!



All times are GMT +1. The time now is 01:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com