http://www.perlmonks.org?node_id=988951


in reply to win 32 OLE Selection property

Hi

It seems to me that this property is set only once in first paragraph and later is not updated.
If that assumption is correct, you might want to store the font-information to a variable outside of the loop and access it inside in case it is not redefined there. Something like:
my $oldFont; # variable to hold the current font while(defined(my $paragraph = $enumerate->Next())) { my $text = $paragraph->{Range}->{Text}; my $sel = $Word->Selection; my $font = $sel->Font; if (!defined($font)) { $font = $oldFont; } # use the old f +ont instead else { $oldFont = $font; } # use this font + for future paragraphs
HTH, Rata