More Page Breaks in Excel

BAMeyer

New Member
I am generating an Excel spreadsheet within a Progress program. Excel is automatically inserting a vertical page break in the middle of the spreadsheet. The Visual Basic macro code generated to manually move the page break to the right edge of the spreadsheet is:

Set ActiveSheet.VPageBreaks(1).Location = Range("M1")

The application is running under Excel 97, SR-2.

Does anyone have a suggestion to:
1. Block Excel from automatically inserting this vertical page break
or
2. Convert the above statement to work in Progress.
I have tried:
worksht1:VPageBreaks(1):Location:(worksht1:Range("L1")).
and get the error:
** Unable to understand after -- "(1):Location". (247)

Any help and/or suggestions would be appreciated! :confused:
 
You can check the existence of a page break by checking what the page break for the cell is set to.

excelAppl:range("E25"):rows:PageBreak = -4135. /* Page Break */
excelAppl:range("E1"):columns:PageBreak = -4142. /* No Break */

message
excelAppl:range("E25"):rows:PageBreak
excelAppl:range("E1"):columns:PageBreak
view-as alert-box.

This should show -4135 and -4212.

So, you'd run a loop through the cell ranges and check the page breaks, turning them on or off as you need.

Moving a page break would be equivalent to turning one off and turning one on, so your example would be equivalent to:

excelAppl:range("L1"):rows:PageBreak = -4212. /* Turn it off */
excelAppl:range("M1"):columns:PageBreak = -4135. /* Turn it on */

Of course, you're better off using the excel constants rather than the actual numbers, but this works as well.

Hope that helps.

Simon

 
Thanks Simon.

You referenced both -4142 & -4212 in your reply. Which code turns the page break off? :confused:

Thanks for the help! :)
 
You should probably use the excel constants, but I never do.

-4212 Turns it off
-4135 Turns it on


They seem to work for horizontal and vertical page breaks.

/*
excelAppl:range("L1"):rows:PageBreak = -4212. /* Turn it off */
excelAppl:range("M1"):columns:PageBreak = -4135. /* Turn it on */

*/

Simon
 
Back
Top