(e-mail address removed) wrote in @g49g2000cwa.googlegroups.com:
[ Please quote an appropriate amount of context when you reply. ]
I don't actually need to strict and get warnings
You may think so. However, originally, you posted:
$generalSheet->Range("A2")->Select;
ActiveWindow->{FreezePanes} = True;
Here is what perl has to say about these lines with strictures and
warnings enabled:
D:\Home\asu1\UseNet\clpmisc> bug
Can't use bareword ("ActiveWindow") as a HASH ref while "strict refs" in
use at D:\Home\asu1\UseNet\clpmisc\bug.pl line 38.
D:\Home\asu1\UseNet\clpmisc> bug
Bareword "True" not allowed while "strict subs" in use at D:\Home\asu1
\UseNet\clpmisc\bug.pl line 38.
Execution of D:\Home\asu1\UseNet\clpmisc\bug.pl aborted due to
compilation errors.
#!/usr/bin/perl
use strict;
use warnings;
use Win32::OLE;
use Win32::OLE::Const 'Microsoft Excel';
$Win32::OLE::Warn = 3;
my $Excel;
eval {
$Excel = Win32::OLE->GetActiveObject('Excel.Application')
};
die "Excel not installed" if $@;
unless (defined $Excel) {
$Excel = Win32::OLE->new('Excel.Application', sub { $_[0]->Quit })
or die "Cannot start Excel";
}
$Excel->{Visible} = 1;
my $Book = $Excel->Workbooks->Add;
my $Sheet = $Book->Worksheets(1);
$Sheet->Cells(1, 3)->{Value} = 'Data';
my $LastRow = $Sheet->Cells->SpecialCells(xlCellTypeLastCell)->{Row};
my @valueArray = qw( value1 value2 value3 value4 );
for my $value (@valueArray) {
$LastRow++;
$Sheet->Cells($LastRow, 3)->{Value} = $value;
}
$Sheet->Columns->AutoFit;
$Sheet->Range("A2")->Select;
$Excel->ActiveWindow->{FreezePanes} = 1;