ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to avoid several print areas being squeezed into one page (https://www.excelbanter.com/excel-programming/294547-how-avoid-several-print-areas-being-squeezed-into-one-page.html)

Frank M.[_2_]

How to avoid several print areas being squeezed into one page
 
In a reporting application I am building a single sheet with many different
print areas as a report. However, when I choose printout all of the areas
are presented on a single with the zoom factor set very low (like 5%).

I cannot find a way to make this behaviour stop. Is it a general setting or
is it something I can control through the code.

It should be mentionened that my spreadsheet is embedded as an OLE object in
a VB form. Thus I do not have access to the full object model of Excel but
only the single sheet in the workbook:

Dim shPrint As Object ' extra ref to the Worksheet object in the OLE
object container that we will work with
Dim sPrtAreaAdr As String

Set shPrint = OLE_keyfig(5).object.Sheets(1)

shPrint.Range("A202:J1200").Value = ""

' Setting a range to to a prepared array
shPrint.Range("A201:J" & CStr(201 + UBound(arrKortXL, 1))).Value =
arrKortXL

Dim iKort As Integer

' This is an effort to stop display in one page by defining separate
print area entries in the range string
Do While iKort < UBound(arrKortXL, 1):
sPrtAreaAdr = sPrtAreaAdr & ",A" & CStr(200 + iKort) & ":J" &
CStr(200 + iKort + 79)
iKort = iKort + 80
Loop

shPrint.PageSetup.PrintArea = sPrtAreaAdr
shPrint.PrintOut Preview:=True

The above still produces one printout page in the preview with the zoom set
to a very low figure. I want a new page per 80 lines. I could define each 80
lines separately and printout right away before defining the next, but then
my footer with page number and total number of pages won't make any sense.

Hope that someone can help.


With kind regards,




Frank M.



NickHK[_2_]

How to avoid several print areas being squeezed into one page
 
Frank,
On the print setup dialog, do you have the Scaling Fit To option selected.

NickHK

"Frank M." wrote in message
...
In a reporting application I am building a single sheet with many

different
print areas as a report. However, when I choose printout all of the areas
are presented on a single with the zoom factor set very low (like 5%).

I cannot find a way to make this behaviour stop. Is it a general setting

or
is it something I can control through the code.

It should be mentionened that my spreadsheet is embedded as an OLE object

in
a VB form. Thus I do not have access to the full object model of Excel but
only the single sheet in the workbook:

Dim shPrint As Object ' extra ref to the Worksheet object in the OLE
object container that we will work with
Dim sPrtAreaAdr As String

Set shPrint = OLE_keyfig(5).object.Sheets(1)

shPrint.Range("A202:J1200").Value = ""

' Setting a range to to a prepared array
shPrint.Range("A201:J" & CStr(201 + UBound(arrKortXL, 1))).Value =
arrKortXL

Dim iKort As Integer

' This is an effort to stop display in one page by defining separate
print area entries in the range string
Do While iKort < UBound(arrKortXL, 1):
sPrtAreaAdr = sPrtAreaAdr & ",A" & CStr(200 + iKort) & ":J" &
CStr(200 + iKort + 79)
iKort = iKort + 80
Loop

shPrint.PageSetup.PrintArea = sPrtAreaAdr
shPrint.PrintOut Preview:=True

The above still produces one printout page in the preview with the zoom

set
to a very low figure. I want a new page per 80 lines. I could define each

80
lines separately and printout right away before defining the next, but

then
my footer with page number and total number of pages won't make any sense.

Hope that someone can help.


With kind regards,




Frank M.





Frank M.[_2_]

How to avoid several print areas being squeezed into one page
 
Right that was what I was looking for. Thanks for the help

Frank M.


"NickHK" wrote in message
...
Frank,
On the print setup dialog, do you have the Scaling Fit To option

selected.

NickHK

"Frank M." wrote in message
...
In a reporting application I am building a single sheet with many

different
print areas as a report. However, when I choose printout all of the

areas
are presented on a single with the zoom factor set very low (like 5%).

I cannot find a way to make this behaviour stop. Is it a general setting

or
is it something I can control through the code.

It should be mentionened that my spreadsheet is embedded as an OLE

object
in
a VB form. Thus I do not have access to the full object model of Excel

but
only the single sheet in the workbook:

Dim shPrint As Object ' extra ref to the Worksheet object in the OLE
object container that we will work with
Dim sPrtAreaAdr As String

Set shPrint = OLE_keyfig(5).object.Sheets(1)

shPrint.Range("A202:J1200").Value = ""

' Setting a range to to a prepared array
shPrint.Range("A201:J" & CStr(201 + UBound(arrKortXL, 1))).Value =
arrKortXL

Dim iKort As Integer

' This is an effort to stop display in one page by defining separate
print area entries in the range string
Do While iKort < UBound(arrKortXL, 1):
sPrtAreaAdr = sPrtAreaAdr & ",A" & CStr(200 + iKort) & ":J" &
CStr(200 + iKort + 79)
iKort = iKort + 80
Loop

shPrint.PageSetup.PrintArea = sPrtAreaAdr
shPrint.PrintOut Preview:=True

The above still produces one printout page in the preview with the zoom

set
to a very low figure. I want a new page per 80 lines. I could define

each
80
lines separately and printout right away before defining the next, but

then
my footer with page number and total number of pages won't make any

sense.

Hope that someone can help.


With kind regards,




Frank M.








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

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