|
| View previous topic :: View next topic |
| Author |
Message |
benkasminbullock@gmail.co Guest
|
Posted: Fri Dec 21, 2007 1:43 am Post subject: Changing the font of Asian character |
|
|
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:
| Quote: | 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? |
|
| Back to top |
|
 |
Google Sponsor

|
Posted: Fri Dec 21, 2007 1:43 am Post subject: Advertisement |
|
|
|
|
| Back to top |
|
 |
Klaus Linke Guest
|
Posted: Fri Dec 21, 2007 3:38 am Post subject: Re: Changing the font of Asian character |
|
|
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
<benkasminbullock@gmail.com> schrieb im Newsbeitrag news:469c6cdb-cf67-44f2-95a1-7335d07d6756@s8g2000prg.googlegroups.com...
| Quote: | 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?
|
|
|
| Back to top |
|
 |
benkasminbullock@gmail.co Guest
|
Posted: Fri Dec 21, 2007 4:47 am Post subject: Re: Changing the font of Asian character |
|
|
On Dec 21, 12:38 pm, "Klaus Linke" <i...@fotosatz-kaufmann.de> wrote:
| Quote: | 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. |
|
| Back to top |
|
 |
Klaus Linke Guest
|
Posted: Fri Dec 21, 2007 11:29 am Post subject: Re: Changing the font of Asian character |
|
|
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
<benkasminbullock@gmail.com> schrieb im Newsbeitrag news:eddd21b5-2198-46b6-a195-0921c09a48ec@e10g2000prf.googlegroups.com...
| Quote: | On Dec 21, 12:38 pm, "Klaus Linke" <i...@fotosatz-kaufmann.de> wrote:
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.
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|