Vous êtes sur la page 1sur 9

'

'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'

Pinyin Macro
Paste this macro carefully between the "Sub" and "End sub" lines.
Pinyin Joe's Tone Mark Macro for Word
Version 1.1, released September 2005
Version 1.2, released August 2010
Version 1.3, released November 2011
Copyright (c) 2005, 2010, 2011 pinyinjoe.com
www.pinyinjoe.com
Version 1.2: u-with-diaresis (umlaut) for German keyboards suggested
by Shirish Pandit. Other users can continue to use the letter "v".
The lines with u-with-diaresis are commented out to avoid problems
when opening this file on Macs and certain other systems. If you need
this letter, go to the last lines in this macro, make sure the is
displaying OK or fix it if if it has turned into garbabe, then
remove the apostrophes to the left of those lines
Version 1.3: fixed problem in Word tables. Many thanks to Ervin Tth for
reporting!
(1) Move number from end-of-word to after-vowels.
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "n1"
.Replacement.Text = "1n"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "n2"
.Replacement.Text = "2n"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "n3"
.Replacement.Text = "3n"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "n4"
.Replacement.Text = "4n"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find

.Forward = False
.Wrap = wdFindContinue
.Text = "ng1"
.Replacement.Text = "1ng"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "ng2"
.Replacement.Text = "2ng"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "ng3"
.Replacement.Text = "3ng"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "ng4"
.Replacement.Text = "4ng"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "r1"
.Replacement.Text = "1r"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "r2"
.Replacement.Text = "2r"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "r3"
.Replacement.Text = "3r"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "r4"
.Replacement.Text = "4r"

.Execute Replace:=wdReplaceAll
End With
'
' (2) Move from after-all-vowels to syllable nucleus.
'
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "ai1"
.Replacement.Text = "a1i"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "ai2"
.Replacement.Text = "a2i"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "ai3"
.Replacement.Text = "a3i"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "ai4"
.Replacement.Text = "a4i"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "ao1"
.Replacement.Text = "a1o"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "ao2"
.Replacement.Text = "a2o"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "ao3"
.Replacement.Text = "a3o"
.Execute Replace:=wdReplaceAll

End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "ao4"
.Replacement.Text = "a4o"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "ei1"
.Replacement.Text = "e1i"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "ei2"
.Replacement.Text = "e2i"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "ei3"
.Replacement.Text = "e3i"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "ei4"
.Replacement.Text = "e4i"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "ou1"
.Replacement.Text = "o1u"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "ou2"
.Replacement.Text = "o2u"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False

.Wrap = wdFindContinue
.Text = "ou3"
.Replacement.Text = "o3u"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "ou4"
.Replacement.Text = "o4u"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "Ou1"
.Replacement.Text = "O1u"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "Ou2"
.Replacement.Text = "O2u"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "Ou3"
.Replacement.Text = "O3u"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "Ou4"
.Replacement.Text = "O4u"
.Execute Replace:=wdReplaceAll
End With
'
' (3) Replace letter-&-number with Unicode character.
'
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "a1"
.Replacement.Text = ChrW(&H101)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue

.Text = "a2"
.Replacement.Text = ChrW(&HE1)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "a3"
.Replacement.Text = ChrW(&H1CE)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "a4"
.Replacement.Text = ChrW(&HE0)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "e1"
.Replacement.Text = ChrW(&H113)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "e2"
.Replacement.Text = ChrW(&HE9)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "e3"
.Replacement.Text = ChrW(&H11B)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "e4"
.Replacement.Text = ChrW(&HE8)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "i1"
.Replacement.Text = ChrW(&H12B)
.Execute Replace:=wdReplaceAll
End With

With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "i2"
.Replacement.Text = ChrW(&HED)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "i3"
.Replacement.Text = ChrW(&H1D0)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "i4"
.Replacement.Text = ChrW(&HEC)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "o1"
.Replacement.Text = ChrW(&H14D)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "o2"
.Replacement.Text = ChrW(&HF3)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "o3"
.Replacement.Text = ChrW(&H1D2)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "o4"
.Replacement.Text = ChrW(&HF2)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue

.Text = "u1"
.Replacement.Text = ChrW(&H16B)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "u2"
.Replacement.Text = ChrW(&HFA)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "u3"
.Replacement.Text = ChrW(&H1D4)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "u4"
.Replacement.Text = ChrW(&HF9)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "v1"
.Replacement.Text = ChrW(&H1D6)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "v2"
.Replacement.Text = ChrW(&H1D8)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "v3"
.Replacement.Text = ChrW(&H1DA)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "v4"
.Replacement.Text = ChrW(&H1DC)
.Execute Replace:=wdReplaceAll
End With

'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'

With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "1"
.Replacement.Text = ChrW(&H1D6)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "2"
.Replacement.Text = ChrW(&H1D8)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "3"
.Replacement.Text = ChrW(&H1DA)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Wrap = wdFindContinue
.Text = "4"
.Replacement.Text = ChrW(&H1DC)
.Execute Replace:=wdReplaceAll
End With
Paste this macro carefully between the "Sub" and "End sub" lines.
Pinyin Joe's Tone Mark Macro for Word
Version 1.1, released September 2005
Version 1.2, released August 2010
Copyright (c) 2005, 2010 pinyinjoe.com
www.pinyinjoe.com

Vous aimerez peut-être aussi