ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Printing: Best Fit (1 Page Wide) (https://www.excelbanter.com/excel-programming/326355-printing-best-fit-1-page-wide.html)

pavlos

Printing: Best Fit (1 Page Wide)
 
Im trying to write this small macro. I need to print a report which should be
the biggest font possible, but no more than 1 page wide. The sh is already
setup as landscape an centered. It can be any number of pages tall.

There are certain things the user could do to change the number of
rows/columns so this has to happen on the fly. I expect to use the
Workbook_BeforePrint event.

I thought of using a Do Until Loop as follows:

Sub BestFitPrint()
Sheet5.PageSetup.Zoom = 100
Do Until Sheet5.VPageBreaks.Count = 0
Sheet5.PageSetup.Zoom = Sheet5.PageSetup.Zoom - 5
Loop

Sheet5.PrintOut
End Sub

It's unlikely that the user will ever be able to print bigger than 100%

Does anyone have a better idea?
I would appreciate some help

Thanks in advance!
--
.- -. Bye Bye
/|6 6|\ - Pavlos
{/(_0_)\}
/ ^ \_
(/_/^\_\)

Don Guillett[_4_]

Printing: Best Fit (1 Page Wide)
 
see what this does for you.
Sub zoomit()
ActiveSheet.UsedRange.Select
ActiveWindow.Zoom = True
End Sub


--
Don Guillett
SalesAid Software

"Pavlos" wrote in message
...
Im trying to write this small macro. I need to print a report which should

be
the biggest font possible, but no more than 1 page wide. The sh is already
setup as landscape an centered. It can be any number of pages tall.

There are certain things the user could do to change the number of
rows/columns so this has to happen on the fly. I expect to use the
Workbook_BeforePrint event.

I thought of using a Do Until Loop as follows:

Sub BestFitPrint()
Sheet5.PageSetup.Zoom = 100
Do Until Sheet5.VPageBreaks.Count = 0
Sheet5.PageSetup.Zoom = Sheet5.PageSetup.Zoom - 5
Loop

Sheet5.PrintOut
End Sub

It's unlikely that the user will ever be able to print bigger than 100%

Does anyone have a better idea?
I would appreciate some help

Thanks in advance!
--
.- -. Bye Bye
/|6 6|\ - Pavlos
{/(_0_)\}
/ ^ \_
(/_/^\_\)




pavlos

Printing: Best Fit (1 Page Wide)
 
Don Im afraid this doesn't seem to work . It seems to change only the screen
font size not the print font size. It doesn't affect the page breaks.

Thanks anyway

"Don Guillett" wrote:

see what this does for you.
Sub zoomit()
ActiveSheet.UsedRange.Select
ActiveWindow.Zoom = True
End Sub


--
Don Guillett
SalesAid Software

"Pavlos" wrote in message
...
Im trying to write this small macro. I need to print a report which should

be
the biggest font possible, but no more than 1 page wide. The sh is already
setup as landscape an centered. It can be any number of pages tall.

There are certain things the user could do to change the number of
rows/columns so this has to happen on the fly. I expect to use the
Workbook_BeforePrint event.

I thought of using a Do Until Loop as follows:

Sub BestFitPrint()
Sheet5.PageSetup.Zoom = 100
Do Until Sheet5.VPageBreaks.Count = 0
Sheet5.PageSetup.Zoom = Sheet5.PageSetup.Zoom - 5
Loop

Sheet5.PrintOut
End Sub

It's unlikely that the user will ever be able to print bigger than 100%

Does anyone have a better idea?
I would appreciate some help

Thanks in advance!
--
.- -. Bye Bye
/|6 6|\ - Pavlos
{/(_0_)\}
/ ^ \_
(/_/^\_\)






All times are GMT +1. The time now is 11:37 PM.

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