sub isWorkbookActive { my ($excel) = @_; eval { return $excel->ActiveWorkbook; }; return 1 if $@ =~ /message filter/; }