use strict; use Win32::OLE; use Win32::OLE::Const 'Microsoft Word'; # set $filepath to the full path to the direcotry where the file to be changed, test.doc, is stored my $filepath = 'C:\tmp'; my $oldfile = $filepath . '\wingding1.doc'; my $newfile = $filepath . '\wingding1-edit.doc'; my $word = Win32::OLE-> GetActiveObject('Word.Application') || Win32::OLE-> new('Word.Application','Quit'); my $doc = $word-> Documents->Open("$oldfile"); # is application visible 0=no 1=yes $word-> {visible} = 0; my $selection = $word->Selection; # select current position # start of Word macro conversion $selection->Find->ClearFormatting; $selection->Find ( Text => "!", ReplacementText => "", Forward => 1, Wrap => wdFindContinue, Format => 0, MatchCase => 0, MatchWholeWord => 0, MatchWildcards => 0, MatchSoundsLike => 0, MatchAllWordForms => 0); $selection->Find->Execute; $selection->MoveRight ( Unit => wdCharacter, Count => 1); $selection->InsertSymbol( { Font=> "Wingdings", CharacterNumber => -4063, Unicode => 1 }); # save word file $word-> ActiveDocument->SaveAs($newfile); # close word file $doc-> Close(); $word-> Quit();