Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: OLE Excel 2003 moving sheets

by davies (Prior)
on Jan 25, 2010 at 18:17 UTC ( [id://819564]=note: print w/replies, xml ) Need Help??


in reply to OLE Excel 2003 moving sheets

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://819564]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (7)
As of 2024-03-29 13:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found