0% found this document useful (0 votes)
267 views

Pinyin Joe Tone Mark Macro Word v1.2

The document describes a macro for Word that inserts tone marks into pinyin to indicate the four tones in Mandarin Chinese. It contains instructions on where to paste the macro in Word and details on how it works by finding and replacing text and numbers with Unicode characters for the different tones.

Uploaded by

Akma Syafiq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
267 views

Pinyin Joe Tone Mark Macro Word v1.2

The document describes a macro for Word that inserts tone marks into pinyin to indicate the four tones in Mandarin Chinese. It contains instructions on where to paste the macro in Word and details on how it works by finding and replacing text and numbers with Unicode characters for the different tones.

Uploaded by

Akma Syafiq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 8

' 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
'
' Version 1.2: u-with-diaresis (umlaut) for German keyboards suggested
' by Shirish Pandit. Other users can continue to use the letter "v".
'
' (1) Move number from end-of-word to after-vowels.
'
With Selection.Find
.Forward = False
.Text = "n1"
.Replacement.Text = "1n"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "n2"
.Replacement.Text = "2n"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "n3"
.Replacement.Text = "3n"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "n4"
.Replacement.Text = "4n"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "ng1"
.Replacement.Text = "1ng"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "ng2"
.Replacement.Text = "2ng"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "ng3"
.Replacement.Text = "3ng"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "ng4"
.Replacement.Text = "4ng"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "r1"
.Replacement.Text = "1r"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "r2"
.Replacement.Text = "2r"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "r3"
.Replacement.Text = "3r"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "r4"
.Replacement.Text = "4r"
.Execute Replace:=wdReplaceAll
End With
'
' (2) Move from after-all-vowels to syllable nucleus.
'
With Selection.Find
.Forward = False
.Text = "ai1"
.Replacement.Text = "a1i"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "ai2"
.Replacement.Text = "a2i"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "ai3"
.Replacement.Text = "a3i"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "ai4"
.Replacement.Text = "a4i"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "ao1"
.Replacement.Text = "a1o"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "ao2"
.Replacement.Text = "a2o"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "ao3"
.Replacement.Text = "a3o"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "ao4"
.Replacement.Text = "a4o"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "ei1"
.Replacement.Text = "e1i"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "ei2"
.Replacement.Text = "e2i"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "ei3"
.Replacement.Text = "e3i"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "ei4"
.Replacement.Text = "e4i"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "ou1"
.Replacement.Text = "o1u"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "ou2"
.Replacement.Text = "o2u"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "ou3"
.Replacement.Text = "o3u"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "ou4"
.Replacement.Text = "o4u"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "Ou1"
.Replacement.Text = "O1u"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "Ou2"
.Replacement.Text = "O2u"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "Ou3"
.Replacement.Text = "O3u"
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "Ou4"
.Replacement.Text = "O4u"
.Execute Replace:=wdReplaceAll
End With
'
' (3) Replace letter-&-number with Unicode character.
'
With Selection.Find
.Forward = False
.Text = "a1"
.Replacement.Text = ChrW(&H101)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "a2"
.Replacement.Text = ChrW(&HE1)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "a3"
.Replacement.Text = ChrW(&H1CE)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "a4"
.Replacement.Text = ChrW(&HE0)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "e1"
.Replacement.Text = ChrW(&H113)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "e2"
.Replacement.Text = ChrW(&HE9)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "e3"
.Replacement.Text = ChrW(&H11B)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "e4"
.Replacement.Text = ChrW(&HE8)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "i1"
.Replacement.Text = ChrW(&H12B)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "i2"
.Replacement.Text = ChrW(&HED)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "i3"
.Replacement.Text = ChrW(&H1D0)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "i4"
.Replacement.Text = ChrW(&HEC)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "o1"
.Replacement.Text = ChrW(&H14D)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "o2"
.Replacement.Text = ChrW(&HF3)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "o3"
.Replacement.Text = ChrW(&H1D2)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "o4"
.Replacement.Text = ChrW(&HF2)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "u1"
.Replacement.Text = ChrW(&H16B)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "u2"
.Replacement.Text = ChrW(&HFA)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "u3"
.Replacement.Text = ChrW(&H1D4)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "u4"
.Replacement.Text = ChrW(&HF9)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "v1"
.Replacement.Text = ChrW(&H1D6)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "v2"
.Replacement.Text = ChrW(&H1D8)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "v3"
.Replacement.Text = ChrW(&H1DA)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "v4"
.Replacement.Text = ChrW(&H1DC)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "1"
.Replacement.Text = ChrW(&H1D6)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "2"
.Replacement.Text = ChrW(&H1D8)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.Text = "3"
.Replacement.Text = ChrW(&H1DA)
.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = False
.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
'

You might also like