Many thanks for the latest comments from Brothers Corion and Oshalla. As shown below I now have a solution that:
1. Moves the insertion point to a set of character(s);
2. Adds a wingding symbol after the character(s)
3. Removes the target string
I looked again at my conversion from a word macro to Perl and made changes.
Eventually I found something that worked! The following lines, find the target character(s), move the insertion point just after and then add the wingding symbol.
$selection->Find->ClearFormatting; $selection->Find->{Text} = "*"; $find_exec_res = $selection->Find->Execute; $move_res = $selection->MoveRight ( {Unit => wdCharacter, Count => 1} +); $selection->InsertSymbol( { Font=> "Wingdings", CharacterNumber => -40 +62, Unicode => 1 });
The search moves forward through the document and therefore will fail if the second target
character is before the first. However, I found that the following moved the insertion point to the
start of the document (perhaps not very elegantly but it works).
$selection->MoveLeft ({Unit => wdCharacter, Count => 9999}); $selection->MoveUp ({Unit => wdLine, Count => 9999});
I believe that there is an option as part of the ‘Find’ that allows you to set the replacement character(s) but I have not made this work as yet.
However I can use the code I already have to remove the target character(s) after I have added the wingding symbol.
I have found that the inserted wingding takes on the target characters characteristic’s such as height and colour.
If there is more than one character in the target string the move is still one character.
On my version of Word (2007) I find that the four ‘symbol’ fonts of wingdings, wingdings 2, wigding3 and webdings have the same ‘mapping’ between the number required in InsertSymbol line and their ASCII value.
The number required is ASCII number – 4096.
I hope this may help anyone else who is trying to modify a word document with Perl.

In reply to Re^6: InsertSymbol usage to modify Word document by merrymonk
in thread InsertSymbol usage to modify Word document by merrymonk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.