Page Size

DannyDont

New Member
Joined
Mar 7, 2014
Messages
32
I am attempting to find the usable page size so that I can set Page Breaks in VBA. I have it working with the following code. But it is only guess work. I would like to be able to know when I am going to overflow the bottom of the usable space rather that guessing at how big it is. There is probably a setting that tells me that but can't seem to find it.

'*******************************************
'*******************************************
Sub UTY_Get_Page_Height()
'*******************************************
'*******************************************
' Control_Page_Height_Begin
' Control_Page_Height_End
' Control_Row_Highest
' Control_Row_Lowest
'Stop
Set Control_Page_Height_Begin = ActiveSheet.Range("A1:F" & Control_Row_Lowest)
Set Control_Page_Height_End = ActiveSheet.Range("A1:F" & Control_Row_Highest)
If Control_Page_Height_End.Height - _
Control_Page_Height_Begin.Height > 450 Then
Control_Row_Type_Hold = Control_Row_Type
ActiveSheet.HPageBreaks.Add Before:=Range("A" & Control_Row_Highest + 1)
UTY_Set_Page_Headers
Control_Row_Type = Control_Row_Type_Hold
Control_Row_Lowest = Control_Row_Highest
End If
End Sub

I have looked at TopMargin and BottomMargin but they do not report the values that I need (want). If I knew the total size of a page (Portrait or Landscape) then I could use these margins. Current I have margins set to .25 inches which returns a value of 18 (unconverted to inches) and am in Landscape.

If I knew the total size of a page, then I could determine when to set the Page Break ... I believe.

Any help or other ideas would be most helpful.

Thanks to all
 
Last edited:

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Forum statistics

Threads
1,171,168
Messages
5,874,152
Members
433,029
Latest member
theodoros1

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top