Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: OLE and Excel question

by Sandy (Curate)
on May 05, 2009 at 21:28 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-19 21:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found