Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: Checking when Excel editing is done

by esr (Scribe)
on Dec 15, 2004 at 16:57 UTC ( #415109=note: print w/ replies, xml ) Need Help??


in reply to Re: Checking when Excel editing is done
in thread Checking when Excel editing is done

Further experimentation indicates that Win32::OLE works differently and does not set $@, nor does the eval make any difference. But error messages can be obtained by using

$errmsg = Win32::OLE->LastError;
This can be searched for the needed string and then ignored. The message still comes out on the screen for the Perl script window but I found that can be turned off by setting the Warn level to 1 instead of 2. So a code snippet that seems to do the job is:
$warnlevel = $Win32::OLE::Warn; $Win32::OLE::Warn=1; $done = 0; while ($done == 0) { if ($excel->ActiveWorkbook) { sleep 15; } else { $errmsg = Win32::OLE->LastError; if ($errmsg =~ m/busy/) { sleep 15; } else { $done = 1; } } } $Win32::OLE::Warn=$warnlevel;


Comment on Re^2: Checking when Excel editing is done
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (12)
As of 2015-07-03 07:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (48 votes), past polls