Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Win32 OLE Excel 2003 question

by gibsonca (Beadle)
on May 05, 2009 at 19:42 UTC ( #762037=perlquestion: print w/ replies, xml ) Need Help??
gibsonca has asked for the wisdom of the Perl Monks concerning the following question:

Windows XP, Perl 5.x, Win32 OLE, Excel 2003

1) After this script runs, and I open the newly created excel file, I can see that the 2nd row is selected, yet the freezepane is not active.

my $freeze_panes = $gExcel->ActiveSheet->Range("2:2")->Select; #$gSheet->Cells(2,2)->Select(); $gExcel->ActiveSheet->{FreezePanes} = $TRUE; # or 1 ..

2) The user occasionally orphans a copy of excel, and I'd like to be able to detect that a copy of excel is already running. This effort does not work (of course): Is there a way to detect an orphaned Excel? YOu have to delete it with windows task manager?

if ($Excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application', 'Quit')) { print "\n123 \n"; } else { print "\n456 \n"; }
Thanks

Comment on Win32 OLE Excel 2003 question
Select or Download Code
Re: Win32 OLE Excel 2003 question
by Corion (Pope) on May 05, 2009 at 20:24 UTC

    What is the value of $TRUE? I don't think it contains what you think it does.

    I'm not aware of any good way of preventing orphaned copies of Excel except not crashing your script.

      So you don't have trouble with freezepane? Great I won't give up. $TRUE is 1, tried using the following: = 1 ; = '1'; = "1"; = $TRUE; Crashing is caused by the user having a copy of excel running, unrelat +ed to the script, when the perl script is run. The involved files are + unique. So it would be best to know that excel is already running before the s +cript is run. I could error out nicely, instead of locking up an orph +aned version of excel.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://762037]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2014-07-31 02:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (244 votes), past polls