I am sorry that I did not explain how it failed but simply it did not work and I did not get any error message!
However, many thanks for your comments because I tried your suggestion and for the first time I got a wingding character in my Word document!!
Almost of course, this leads to the next problem. How to get the character in the correct place?
I can ‘see’ VBA word examples of inserting text at a particular position but I am struggling both to understand how to convert this to Perl and more importantly how to adapt this to get the wingding at the right place.
What I could use is something like
1. have a unique character string in the Word document;
2. find that string;
3. remove the string (perhaps by simply replacing it by ‘nothing’)
4. add the wingding at that position;
I have already got code that works for steps 2 and 3. I did hope that this would make the ‘current’ position (or whatever is required) to be where the original string was in the documents (so that the wingding symbol would be inserted at this point).
Therefore I simply added the now working InsertSymbol line after these steps as shown next.
$search_res = $search-> {Text} = "\x{0021}"; $replace-> {Text} = "\x{0022}"; $exec_res = $search-> Execute({Replace => wdReplaceAll}); $selection->InsertSymbol( { Font=> "Wingdings", CharacterNumber => -40 +63, Unicode => 1 });
I used the lines on a Word file that contained an ! (the hex code 0021). This did replace the ! with a “ (hex code 0022). However, the wingding character was placed at the beginning of the document.
How do I ‘set’ the position for the wingding character to be where the changed character string was in the original document?

In reply to Re^2: 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.