#!perl use strict; use Win32::OLE 'in'; use Win32::OLE::Const 'Microsoft Excel'; $Win32::OLE::Warn = 3; # Die on Errors. # config my $dir = 'c:/temp/'; my $file = 'perl.xlsx'; my $Excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application', 'Quit'); $Excel->{DisplayAlerts} = 0; #$Excel->{Visible} = 1; my $Book = $Excel->Workbooks->Open($dir.$file); my $ws = $Book->Worksheets(1); for my $c (in $ws->comments) { print $c->text."\n"; my $str = $c->{'Shape'}->{'TextFrame'}->Characters(); $str->{'Font'}->{'ColorIndex'} = 3; # red } # close $Book->Save; $Excel->Quit(); undef $Book; undef $Excel;