use warnings; use strict; use Win32::OLE; use Data::Dumper; $Data::Dumper::Maxdepth = 2; my $MSWord = Win32::OLE->new('Word.Application', 'Quit') or die $!; $MSWord->{Visible} = 1; my $doc = $MSWord->Documents->Open('C:/temp/hyper.docm'); local $, = "\t"; my $url = 'http://www.perlmonks.org/'; my $HLs = $doc->Hyperlinks(); foreach my $ihl ( 1 .. $HLs->Count ) { # ->Item() is 1-based, not 0-based print STDERR $ihl, $HLs->Item($ihl), @{ $HLs->Item($ihl) }{'TextToDisplay', 'Address', 'SubAddress'}; @{ $HLs->Item($ihl) }{'Address', 'SubAddress'} = ($url, ''); print STDERR $ihl, $HLs->Item($ihl), @{ $HLs->Item($ihl) }{'TextToDisplay', 'Address', 'SubAddress'}; } $doc->Save; $doc->Close;