in reply to Inserting pagebreak in excel
wait .. your code actually worked for me (code borrowed mostly from Using Win32::OLE and Excel - Tips and Tricks).Rows("6:6").Select ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=ActiveCell
Update: If i add a $Book->SaveAs('C:\Documents and Settings\David\temp\test.xls'); line in there, then open text.xls, then the page break is NOT there. Hmm.. just crappy Excel behavior??use strict; use warnings; use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Excel'; use Win32::OLE::Variant; use Win32::OLE::NLS qw(:LOCALE :DATE); $Win32::OLE::Warn = 3; # Die on Errors. my $Excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application', 'Quit'); $Excel->{Visible} = 1; my $Book = $Excel->Workbooks->Add(); my $row = 6; $Excel->Worksheets(1)->HPageBreaks->Add({ Before => $Excel->Worksheets +(1)->Range("A$row") });
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Inserting pagebreak in excel
by !1 (Hermit) on Nov 10, 2005 at 00:37 UTC |