InsertSymbol inserts symbol as formated text the first time

A

Anna Neiderud

Hi,

I have a problem with InsertSymbol that I have seen nowhere else. I need to
insert a character from a symbol font and want it to have symbol behaviour,
i.e. if I mark a range containing the character afterwards and select another
font, the symbol character won't change. This might sound simple and I
thought it was, but generally it doesn't work the first few times...

In a fresh Word application I use the code below to insert a symbol
character with some other symbol font than Symbol and the first and sometimes
first few character will be wrong:

Sub InsertWayPointerSymbol()
Dim rng As Range
Dim i As Long
Set rng = Selection.Range.Duplicate
For i = 0 To 30
rng.InsertSymbol AscW("n"), "Marlett"
rng.MoveEnd wdCharacter
rng.Font.Name = "Times New Roman"
rng.Collapse wdCollapseEnd
Next i
End Sub

I assume this has something to do with the font not being fully initialized
before I start, but can I force it to be somehow?

I tried simply inserting one character and removing it first, but the
problem is I do not know how many times I need to fix it. On some users
machines the problem occurs for a longer time.

Would I be guaranteed that it will work if I add a style containing the
symbol font to the template that is used? Or can I programmatically create a
style or something to force the font to be initialized?

For readers familiar with WordML it might be helpfull to see the difference
in wordml between the incorrect and correct character:

Incorrect:
<w:r>
<w:rPr>
<w:rFonts w:ascii="Marlett" w:h-ansi="Marlett" />
<wx:font wx:val="Marlett" />
<wx:sym wx:font="Marlett" wx:char="F06E" />
</w:rPr>
<w:t>n</w:t>
</w:r>
Correct:
<w:r>
<w:rPr>
<w:rFonts w:ascii="Marlett" w:h-ansi="Marlett" />
<wx:font wx:val="Marlett" />
</w:rPr>
<w:sym w:font="Marlett" w:char="F06E" />
</w:r>

Greatful for any suggestions!
/Anna
 
K

Klaus Linke

Hi Anna,

Looks like a bug to me. It doesn't happen with my usual settings (Normal.dot ...), but does when I start Word2003 with the /a switch.

As a work-around, you could use the dialog to insert the symbol (at least, the first time... your code seems to work fine after that):
With Dialogs(wdDialogInsertSymbol)
.Font = "Marlett"
.CharNum = AscW("n")
.Execute
End With

Unfortunately, Microsoft doesn't have a web interface that allows users to report bugs.
Respectively, all existing web interfaces I have used in the past later were discovered to be black holes.

You could try to report the problem to PSS, but they a) probably won't know how to deal with it, b) will give you a hard time, c) you'll have to look out you don't have to pay for it d) PSS may swamp you with support offers once you have given your personal information/address:
http://support.microsoft.com/oas/default.aspx?ln=en-us&sd=offn&prid=6685&gprid=36084

Regards,
Klaus
 
A

Anna Neiderud

Thanks for your support!

It looked great, but unfortunately I managed to reproduce the problem even
with that solution. Now I found another way to go - I use symbol fields
instead, i.e.:

Dim f As Field
Set f = rng.Fields.Add(rng)
f.Code.Text = " symbol " & AscW("n") & "\f ""Marlett"""

/Anna
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top