Dzwebs.Net

撰写电脑技术杂文十余年

word用VBA快速输入拼音

Admin | 2014-12-19 3:34:24 | 被阅次数 | 3460

温馨提示!

如果未能解决您的问题,请点击搜索;登陆可复制文章,点击登陆

  只要拼音不要汉字怎么输入?找“软键盘”?一个个输入费时费力,还容易出错。下面介绍一个方法:

  输入时输入对应的元音加声调,然后利用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


网站备案号:

网站备案号:滇ICP备11001339号-7

版权属性:

Copyright 2007-2021-forever Inc. all Rights Reserved.

联系方式:

Email:dzwebs@126.com QQ:83539231