Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 345
Default Unwanted Sub Exit, Ws in page break preview View

Hi All,
Code below is part of a Sub that does route book pagination.

My problem is that the Sub EXITS on certain lines, marked
by ???? when the Ws is in page break preview view, and yet the
lines run OK when in Normal view. I do not understand.

I have not read anywhere that there is any diff when running a
macro for a Ws in preview view, yet my tests prove otherwise.
So,

Q1. When dealing with page breaks, why is there a diff between
the Normal and page break preview views ?

Q2. I have screen updating turned off, yet when the books
are large, 50 pages, it takes a while. Is inserting page
breaks a "slow" thing?

The sub has been written to either re-page the entire route
or selected pages depending on how the calling macro inserts
or deletes rows, which equate to a page in the route book.

Thanks much,
Neal Z.

p.s. In looking at some of postings page breaks, there seems
to be a theme regarding the preview view.

' Get last printed row in route as needed, reset if entire route
' is being repaginated.
' MSo help, To remove all manual page breaks on a worksheet,
' set Cells.PageBreak to xlPageBreakNone. (see my comment below)

If Int(HInum / RowsPPg) = gMinRtPgQty Then 'RowsPPg=rows per page

RtWsLasRow = RtWsLasRow_FindF(RtWs, LefCol) 'function works OK

If (LOnum = RowsPPg + 1) And HInum = RtWsLasRow Then

RtWs.ResetAllPageBreaks 'line to left execs OK in either view.
' Sub exits on line below in page break preview view, took it out
' RtWs.Cells.xlPageBreakNone ???

If LefCol 1 Then RtWs.Columns(LefCol).PageBreak = xlPageBreakManual

'MSO, This example sets a manual page break to the left of column J on Sheet1.
'MSO, Worksheets("Sheet1").Columns("J").PageBreak = xlPageBreakManual

' in page break preview view, sub exits after line below execs, ???
' RigCol value is 3. In Normal view, it runs OK.
RtWs.Columns(RigCol + 1).PageBreak = xlPageBreakManual

' Limit route to the last row
If HInum (RtWsLasRow + 1) Then HInum = RtWsLasRow + 1
End If
End If


'Break the pages
For Row = LOnum To HInum Step RowsPPg

'MSo, Worksheets("Sheet1").Rows(25).PageBreak = xlPageBreakManual
'' In Normal view, this loop completes as anticipated.
'' In page break preview view, Sub EXITS after line below execs
'' when Row = HInum, ??????, (last wanted interation of loop)

If RtWs.Rows(Row).PageBreak < xlPageBreakManual Then _
RtWs.Rows(Row).PageBreak = xlPageBreakManual

'Show status bar if 5 pages are being re-paginated.
If ((HInum - LOnum) / RowsPPg) 5 Then

PgNum = Int(Row / RowsPPg)

If PgNum Mod 5 = 0 Then Application.StatusBar = _
"Page Re-Number At Page " & PgNum
End If

Next Row

'There is code below here that does not exec when sub
'exits "prematurely" that I want to run, clearly an unwanted thing.

Thanks again,
Neal Z
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
View in page break preview JOJO Excel Discussion (Misc queries) 0 July 15th 08 05:09 PM
How do I do page breaks when view menu doesnt page break preview HeatherF55 Excel Discussion (Misc queries) 0 September 21st 07 04:24 AM
change and/or remove page number watermark in page break preview juga Excel Discussion (Misc queries) 2 December 25th 06 10:15 AM
print preview v page break preview SamB Excel Discussion (Misc queries) 0 November 16th 06 05:09 PM
Print Preview and Page Break View do not show on my computer DEE Excel Discussion (Misc queries) 1 September 6th 06 09:57 PM


All times are GMT +1. The time now is 05:25 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"