Determining Portrait or Landscape

O

Otto Moehrbach

Excel XP & Win XP
I am helping an OP with a task that involves hiding/unhiding a variable
number of columns. When it comes time for the code to print, it will be
necessary that the code select Portrait or Landscape for the printing,
depending on the total width of the visible columns (either way, the print
range is no more than one page wide).
My question is: What would be the code to determine the location of the
first vertical page break?
Thanks for your time. Otto
 
G

Guest

This was obtained from the VBA Help file:

This example sets a manual page break above row 25 on Sheet1.

Worksheets("Sheet1").Rows(25).PageBreak = xlPageBreakManual

This example sets a manual page break to the left of column J on Sheet1.

Worksheets("Sheet1").Columns("J").PageBreak = xlPageBreakManual

This example deletes the two page breaks that were set in the preceding
examples.

Worksheets("Sheet1").Rows(25).PageBreak = xlPageBreakNone
Worksheets("Sheet1").Columns("J").PageBreak = xlNone

Have fun..
 

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