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;