Hi All,

I have tried many different approaches to getting Excel to Page Break
automatically when I instruct it to, it seems to ignore the command
completely, anyone have any ideas.

oExcel.ActiveWindow.SelectedSheets.HPageBreaks.Add(oExcel.ActiveCell)

oRange = oBook.Sheets(1).Range("A"+cStartRow+":A"+cEndRow)
oBook.Sheets(1).HPageBreaks.Add(oRange)


Thanks in advance
Tanya

RE: Page Break in Excel by MichelRoy

MichelRoy
Thu Dec 08 15:38:01 CST 2005

the syntax, from a recorded macro

Rows("10:10").Select
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=ActiveCell

"Tanya Legault" wrote:

> Hi All,
>
> I have tried many different approaches to getting Excel to Page Break
> automatically when I instruct it to, it seems to ignore the command
> completely, anyone have any ideas.
>
> oExcel.ActiveWindow.SelectedSheets.HPageBreaks.Add(oExcel.ActiveCell)
>
> oRange = oBook.Sheets(1).Range("A"+cStartRow+":A"+cEndRow)
> oBook.Sheets(1).HPageBreaks.Add(oRange)
>
>
> Thanks in advance
> Tanya
>
>
>

RE: Page Break in Excel by MichelRoy

MichelRoy
Thu Dec 08 15:56:04 CST 2005

now in a more civilized language

oXl = CREATEOBJECT("Excel.Application")
oXL.Workbooks.add
oSheet = oXl.ActiveSheet
oSheet.Cells(2,2) = "HELLO How are you doing?"
oSheet.Cells(10,2) = "ALLO comment ca va?"
oSheet.Rows("7:7").Select
oSheet.HPageBreaks.Add(oSheet.Cells(7,1))

oxl.visible = .t.


"Tanya Legault" wrote:

> Hi All,
>
> I have tried many different approaches to getting Excel to Page Break
> automatically when I instruct it to, it seems to ignore the command
> completely, anyone have any ideas.
>
> oExcel.ActiveWindow.SelectedSheets.HPageBreaks.Add(oExcel.ActiveCell)
>
> oRange = oBook.Sheets(1).Range("A"+cStartRow+":A"+cEndRow)
> oBook.Sheets(1).HPageBreaks.Add(oRange)
>
>
> Thanks in advance
> Tanya
>
>
>