Changing the font of Asian character

B

benkasminbullock

A job I frequently need to do is to change a particular Japanese
character, $B!n(B, which is a degree sign plus a C, into a Western style
degree sign plus a C, as in $B!k(BC. In Word, it is easy for me to find and
replace the character. However, after I have done that, I am left with
the degree sign in the Japanese font. If I select the degree sign and
then change the font to Times New Roman, Word changes it correctly,
but I have not been able to automate this process. Strategies I've
tried include:

1. Recording a macro as I change the font. This fails because the
macro is empty - nothing is recorded.

2. Writing a macro and explicitly requesting a change of font name.
I've tried the following two ideas:

a. Selection.Font.Name = "Times New Roman"
b. Selection.Font.NameFarEast = "Times New Roman"
c. Selection.LanguageID = wdEnglishUS

Idea a. simply does nothing - the selected text remains in its
original state, and as far as I can see "Times New Roman" is added to
the style.

Idea b. causes a crash:
Run-time error '5844':

One of the values passed to this method or property is incorrect.

Idea c. doesn't do anything.

Note that changing the language (idea c) or changing the font (idea a)
in Word both achieve the correct result.

I can't think of anything else to try, so does anyone have a good
idea?
 
K

Klaus Linke

Your ideas a and c together should do the trick.

I use something like

Selection.Find.ClearFormatting
With Selection.Find
.Text = ChrW(8451)
.Forward = True
.Wrap = wdFindContinue
.Format = False
End With
While Selection.Find.Execute
Selection.Delete
Selection.Text = "oC"
Selection.LanguageID = wdEnglishUS
Selection.Font.Name = "Times New Roman"
Wend

It seems you can't get it to work doing a simple ReplaceAll... I guess because the change in font does not really take effect until you've changed the language.

Regards,
Klaus
 
B

benkasminbullock

Your ideas a and c together should do the trick.

I use something like

Selection.Find.ClearFormatting
With Selection.Find
.Text = ChrW(8451)
.Forward = True
.Wrap = wdFindContinue
.Format = False
End With
While Selection.Find.Execute
Selection.Delete
Selection.Text = "oC"
Selection.LanguageID = wdEnglishUS
Selection.Font.Name = "Times New Roman"
Wend

Thank you for your assistance, but unfortunately this method doesn't
seem to work for me - the problem with the degree being a Japanese
symbol with a big piece of whitespace on its right doesn't go away.
 
K

Klaus Linke

You do use the degree sign Alt+0176?
Selection.Text = "°C"

What's the font of the degree sign?

The problem has driven me mad in the past, too. Sometimes I've cut the text, used Selection.Font.Reset, and then pasted unformatted.

Regards,
Klaus
 

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