Easier than I thought. We need the AppEvents interface. You should be able to adapt this code to your needs:
use warnings;
use strict;
use Win32::OLE qw(EVENTS);
my $Excel = Win32::OLE->new('Excel.Application');
$Excel->{Visible} = 1;
my $Workbook = $Excel->Workbooks->Add;
sub Event {
my ($Obj,$Event,@Args) = @_;
print "Event triggered: '$Event'\n";
}
Win32::OLE->WithEvents($Excel, \&Event, 'AppEvents');
while (1) {
sleep(1);
Win32::OLE->SpinMessageLoop;
}
--
May the Source be with you.
You said you wanted to be around when I made a mistake; well, this could be it, sweetheart.
|