Introduction on typing Pinyin with tones.
1. In MS Word, Go to tools, macro, and click on macros.
2. Type in a name for the macro, such as pinyin, and click Create. A
Microsoft Visual Basic window will pop up.
3. Copy and paste the entire text of the pinyin.txt file after the
green text and before "End Sub".
4. Click File, Save.
5. Close the Visual Basic Window.
6. To run the macro, back in MS Word simply go back to tools, macro,
and run the pinyin macro. It will work on any text you have highlighted.
A.
With Selection.Find
.Text = "r1"
.Replacement.Text = "1r"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "r2"
.Replacement.Text = "2r"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "r3"
.Replacement.Text = "3r"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "r4"
.Replacement.Text = "4r"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "r5"
.Replacement.Text = "5r"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "ng1"
.Replacement.Text = "1ng"
Selection.Find.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Text = "ng2"
.Replacement.Text = "2ng"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "ng3"
.Replacement.Text = "3ng"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "ng4"
.Replacement.Text = "4ng"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "ng5"
.Replacement.Text = "5ng"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "n1"
.Replacement.Text = "1n"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "n2"
.Replacement.Text = "2n"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "n3"
.Replacement.Text = "3n"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "n4"
.Replacement.Text = "4n"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "n1"
.Replacement.Text = "5n"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "ai1"
.Replacement.Text = "a1i"
Selection.Find.Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Text = "ai2"
.Replacement.Text = "a2i"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "ai3"
.Replacement.Text = "a3i"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "ai4"
.Replacement.Text = "a4i"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "ai5"
.Replacement.Text = "a5i"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "ei1"
.Replacement.Text = "e1i"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "ei2"
.Replacement.Text = "e2i"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "ei3"
.Replacement.Text = "e3i"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "ei4"
.Replacement.Text = "e4i"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "ei5"
.Replacement.Text = "e5i"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "ao1"
.Replacement.Text = "a1o"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "ao2"
.Replacement.Text = "a2o"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "ao3"
.Replacement.Text = "a3o"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "ao4"
.Replacement.Text = "a4o"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "ao5"
.Replacement.Text = "a5o"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "ou1"
.Replacement.Text = "o1u"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "ou2"
.Replacement.Text = "o2u"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "ou3"
.Replacement.Text = "o3u"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "ou4"
.Replacement.Text = "o4u"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "ou5"
.Replacement.Text = "o5u"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "uu1"
.Replacement.Text = "v1"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "uu2"
.Replacement.Text = "v2"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "uu3"
.Replacement.Text = "v3"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "uu4"
.Replacement.Text = "v4"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "uu"
.Replacement.Text = ChrW(&HFC)
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "o1"
.Replacement.Text = ChrW(&H14D)
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "o2"
.Replacement.Text = ChrW(&HF3)
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "o3"
.Replacement.Text = ChrW(&H1D2)
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "o4"
.Replacement.Text = ChrW(&HF2)
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "e1"
.Replacement.Text = ChrW(&H113)
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "e2"
.Replacement.Text = ChrW(&HE9)
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "e3"
.Replacement.Text = ChrW(&H11B)
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "e4"
.Replacement.Text = ChrW(&HE8)
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "i1"
.Replacement.Text = ChrW(&H12B)
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "i2"
.Replacement.Text = ChrW(&HED)
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "i3"
.Replacement.Text = ChrW(&H1D0)
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "i4"
.Replacement.Text = ChrW(&HEC)
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "u1"
.Replacement.Text = ChrW(&H16B)
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "u2"
.Replacement.Text = ChrW(&HFA)
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "u3"
.Replacement.Text = ChrW(&H1D4)
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "u4"
.Replacement.Text = ChrW(&HF9)
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "v1"
.Replacement.Text = ChrW(&H1D6)
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "v2"
.Replacement.Text = ChrW(&H1D8)
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "v3"
.Replacement.Text = ChrW(&H1DA)
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "v4"
.Replacement.Text = ChrW(&H1DC)
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "a1"
.Replacement.Text = ChrW(&H101)
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "a2"
.Replacement.Text = ChrW(&HE1)
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "a3"
.Replacement.Text = ChrW(&H1CE)
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "a4"
.Replacement.Text = ChrW(&HE0)
End With
Selection.Find.Execute Replace:=wdReplaceAll
B.
With Selection.Find
.Text = ChrW(&H14D)
.Replacement.Text = "o1"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ChrW(&HF3)
.Replacement.Text = "o2"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ChrW(&H1D2)
.Replacement.Text = "o3"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ChrW(&HF2)
.Replacement.Text = "o4"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ChrW(&H113)
.Replacement.Text = "e1"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ChrW(&HE9)
.Replacement.Text = "e2"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ChrW(&H11B)
.Replacement.Text = "e3"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ChrW(&HE8)
.Replacement.Text = "e4"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ChrW(&H12B)
.Replacement.Text = "i1"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ChrW(&HED)
.Replacement.Text = "i2"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ChrW(&H1D0)
.Replacement.Text = "i3"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ChrW(&HEC)
.Replacement.Text = "i4"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ChrW(&H16B)
.Replacement.Text = "u1"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ChrW(&HFA)
.Replacement.Text = "u2"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ChrW(&H1D4)
.Replacement.Text = "u3"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ChrW(&HF9)
.Replacement.Text = "u4"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ChrW(&H1D6)
.Replacement.Text = "v1"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ChrW(&H1D8)
.Replacement.Text = "v2"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ChrW(&H1DA)
.Replacement.Text = "v3"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ChrW(&H1DC)
.Replacement.Text = "v4"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ChrW(&H101)
.Replacement.Text = "a1"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ChrW(&HE1)
.Replacement.Text = "a2"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ChrW(&H1CE)
.Replacement.Text = "a3"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ChrW(&HE0)
.Replacement.Text = "a4"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "v1"
.Replacement.Text = "uu1"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "v2"
.Replacement.Text = "uu2"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "v3"
.Replacement.Text = "uu3"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "v4"
.Replacement.Text = "uu4"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ChrW(&HFC)
.Replacement.Text = "uu"
End With
Selection.Find.Execute Replace:=wdReplaceAll
No comments:
Post a Comment