in reply to Re^3: excel page breaks???
in thread Help inserting page break in Microsoft Excel using OLE

Thank you for that advice. My code is now:
use warnings; use strict; use OLE; use Win32::OLE::Const 'Microsoft Excel'; my $excel = CreateObject OLE 'Excel.Application'; my $workbook = $excel -> Workbooks -> Add; my $sheet = $workbook -> Worksheets("Sheet1"); $sheet -> Activate(); $sheet -> Range("6:6") -> Activate(); $sheet -> HPPageBreaks -> Add(Before => $sheet -> ActiveCell);
I now receive an error for the last line which reads "Can't call method 'Add' on an undefined value." Did I not read your advice correctly>

Replies are listed 'Best First'.
Re^5: excel page breaks???
by RazorbladeBidet (Friar) on Mar 01, 2005 at 18:54 UTC
    Looks like you have an extra P in HPageBreaks. Try removing that (I'm simply comparing to ikegami's code)
    --------------
    It's sad that a family can be torn apart by such a such a simple thing as a pack of wild dogs
      Don't I feel like a sap? Thank you. Here is the new code:
      use warnings; use strict; use OLE; use Win32::OLE::Const 'Microsoft Excel'; my $excel = CreateObject OLE 'Excel.Application'; my $workbook = $excel -> Workbooks -> Add; my $sheet = $workbook -> Worksheets("Sheet1"); $sheet -> Activate(); $sheet -> Range("6:6") -> Activate(); $sheet -> HPageBreaks -> Add(Before => $sheet -> ActiveCell);
      Now there is no error message, but still no page break.