萬盛學電腦網

 萬盛學電腦網 >> WORD教程 >> WORD使用技巧 >> word用VBA快速輸入拼音

word用VBA快速輸入拼音

   輸入時輸入對應的元音加聲調,然後利用VBA統一替換,這樣速度快多了。

  如:she1ng dia4o

  選中後,運行下面的宏就可得到:

  shēng diào

  對於有時要輸入小學語文類的拼音尤其有用。可以考慮把這個宏放到對應的模板中。

  VBA代碼如下:

  Dim findarr, replacearr

  Dim i As Long

  Application.ScreenUpdating = False

  findarr = Array("a1", "a2", "a3", "a4", _

  "o1", "o2", "o3", "o4", _

  "e1", "e2", "e3", "e4", _

  "i1", "i2", "i3", "i4", _

  "u1", "u2", "u3", "u4", _

  "v1", "v2", "v3", "v4")

  replacearr = Array("ā", "á", "ǎ", "à", _

  "ō", "ó", "ǒ", "ò", _

  "ē", "é", "ě", "è", _

  "ī", "í", "ǐ", "ì", _

  "ū", "ú", "ǔ", "ù", _

  "ǖ", "ǘ", "ǚ", "ǜ")

  For i = 0 To UBound(findarr)

  With Selection.Find

  .Execute findarr(i), MatchWildcards:=False, Format:=False, replacewith:=replacearr(i), Replace:=wdReplaceAll

  End With

  Next

  Application.ScreenUpdating = True

  End Sub

copyright © 萬盛學電腦網 all rights reserved