Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: OLE and Excel question

by Sandy (Curate)
on May 05, 2009 at 21:28 UTC ( #762084=note: print w/replies, xml ) Need Help??

in reply to OLE and Excel question

for your first question

Sometimes it really helps to run the Excel macros and see what that gives you

Range("B2").Select ActiveWindow.FreezePanes = True
This (translated to perl) works for me
my $freeze_panes = $gExcel->ActiveSheet->Range("B2")->Select; #$gSheet->Cells(2,2)->Select(); $gExcel->ActiveWindow->{FreezePanes} = 1;
I changed ActiveSheet to ActiveWindow

and set the selection to a single cell (instead of a row). If set to a row (2:2) it still works by freezing only the top row.

Replies are listed 'Best First'.
Re^2: OLE and Excel question
by Nkuvu (Priest) on May 05, 2009 at 21:48 UTC

    My general approach is (very) slightly different:

    # The number of rows above the split: $Excel->ActiveWindow->{SplitRow} = 1; $Excel->ActiveWindow->{FreezePanes} = 1;

    No selection or intermediate variable necessary ($freeze_panes -- used somewhere else in the code?).

    In regards to the second question, are you (by "you" I mean gibsonca) calling $Excel->Quit() when you're done with Excel? Also note that I've found that if my script terminates early, the application isn't always killed properly.

Re^2: OLE and Excel question
by gibsonca (Beadle) on May 06, 2009 at 21:55 UTC
    Thanks. Your suggestion worked and my problem solved.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://762084]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2018-02-19 02:33 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (258 votes). Check out past polls.