use strict;
use diagnostics;
use warnings;
use Win32::OLE;
my $xl = Win32::OLE->new('Excel.Application');
$xl->{Visible} = 1;
my $wb = $xl->Workbooks->Add;
my $nSheets = $wb->Sheets->Count;
if ($nSheets < 3) {
for ($nSheets .. 2) {
$wb->Sheets->Add({After=>$wb->Sheets($wb->Sheets->Count)});
}
}
$wb->Sheets(3)->Move({Before=>$wb->Sheets(1)});
I think it's the last line you'll be interested in. I had to write the rest to test it (my default is one sheet), so it's all there for posterity. Watch for the differences between (brackets) and {braces} if you're peeking and poking.
Regards,
John Davies