PageBreak-broke?

N

nope

I have been working on adding pagebreaks within some report results
sheets.

Everything indicates that they are being created correctly and I have
been able to run some things which show they they are there, thanks to
some good examples from all you folks.

However on screen in PageBreak preview mode no page breaks are visible
except the exterior boundaries of the PrintArea.
Is the set PrintArea doing this?

I have never been much involved in the printed output of reports.
Thank You,

ScottD
 
N

nope

I should mention ActiveSheet.ReSetAllPageBreaks doesn't seem to do
what I expect either.
Shouldn't all pagebreaks be eliminated?
Sorry I am a page break novice.

ScottD
 
A

AlexT

Scott,

I believe that there are some bugs in XL where the page break area
should be in a *visible* part of the worksheet for the pagebreak to
work correctly.

In other words try to scroll you worksheet before adding the page
break.

Hope it helps

alex
 
N

nope

just there is more to goon here....

I determined where the pagebreaks should occur by setting a variable.
Everything seems to work using

ActiveSheet.ResetAllPageBreaks
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=Range("A" &
PB(2))
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=Range("A" &
PB(3))
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=Range("A" &
PB(4))
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=Range("A" &
PB(5))


I just don't see any of the pagebreaks in printpreview or anywhere,
They are there but they aren't...

I used to check...

Sub whereisPB()
Dim test As String
test = ActiveWindow.SelectedSheets.HPageBreaks(2).Location.Address
End Sub

to check each one HPageBreaks(3) etc...


Sure i am missing something simple.
Thank You
ScottD
 
T

Tom Ogilvy

RE: PageBreak preview mode

if you set a printarea that doesn't include your pagebreaks, then they
wouldn't appear in this view. Only pagebreaks that are within the white
area.
 
N

nope

Thank You Tom.
I have set a printarea range of "a1:J500" (this changes and is set in
code although J is the absolute right column)
and the pagebreaks don't appear in pagebreakpreview although they are
set by designating
A3 or A130 or A222 as the location to insert them.
Of course the actual area to insert them changes based on the row
location of a calendar week header postion.
Appreciate your input

ScottD
 
T

Tom Ogilvy

I don't have an answer. If pagebreaks are going to appear anywhere, I would
expect to see them in pagebreak peview mode under the view menu.
 
N

nope

No I don't have a printer on this machine. I never thought of that.

I have since chosen a printer and set the print area to A1:J500.
Didn't help

Where do the automatic page breaks derive from? It seems not to be
able to figure out where to add them either.
I get a long 500 row sheet in preview.
All pagebreaks don't show and no new ones are adding with any visible
cue.

In TOOLS>OPTIONS>VIEW the under Window Options PageBreaks option is
disabled I notice. (if I am in PageBreakPreview mode)
changing it in Normal view doesn't change things.


I am sure this must be something I have done. I just don't know what.

Thanks to anyone with an idea.
..
 
N

nope

Ok I found it is related to Page Setup. it was set at 1 page wide and
1 page long. I adjust manually and it displays differently. How do I
change the PageSetup to reflect the correct qty of pages? I thought
changing things by inserting PageBreaks was enough in code.

ScottD

If you try enough you eventually figure out what you wanted to blame
on something else was you.
 
T

Tom Ogilvy

If you don't use scaling or fit to print, then you should see the number of
pages. Just remember that if the page can only hold 65 rows and you put a
page break at 75 rows, you will get an automatic pagebreak at 65 rows and
your manual pagebreak at 75. That is just a fact of life. The printer
selected along with margins and so forth will dictate what can fit on the
page.
 
N

nope

Thank You Tom,
I am trying to present the page at 75%.
I do see PAGE1 showing but no others. I see what you mean about a page
holding 65 rows but I don't even see a page break at row 2 if I set it
there. if I manually set a pagebreak nothing seems to happen at all.
I am sure it is just to many hours of me thinking about this the wrong
way.
More tomorrow I suppose.

Thank you again.
ScottD
 
C

Claud Balls

I drove myself nuts trying to remove auto page breaks, and insert my
own, with very unstable results. Now I just determine how many blank
lines to insert to shove new data onto the next page.

Private Sub cmdPrint_Click()
Dim intBreakRow As Integer, intNumBreaks As Integer
Dim intCurBreak As Integer, intInsert As Integer
intInsert = 0
intCurBreak = 1
intBreakRow = 69
intNumBreaks = Sheets("today").UsedRange.Rows.Count / 69
While intCurBreak < intNumBreaks
If Sheets("today").Range("D" & intBreakRow) <> "" Then
intBreakRow = intBreakRow - 1
intInsert = intInsert + 1
Else
For c = 1 To intInsert
Sheets("today").Rows(intBreakRow).Insert Shift:=xlDown
Next

intBreakRow = intBreakRow + intInsert + 69
intInsert = 0
intCurBreak = intCurBreak + 1
End If
Wend
Application.Dialogs(xlDialogPrint).Show
End Sub
 
T

Tom Ogilvy

Fit to print will ignore pagebreaks. But scaling alone should not. Fit to
print will put a number in the scaling textbox, but that just shows you what
Fit to print will use for scaling (it doesn't mean you are using scaling as
your method of printing - scaling would need to be selected specifically and
then fit to print would not be selected since these are option buttons).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top