在线试用
微信扫码联系专属客服
安企神软件官网
首页
下载中心
客户列表
课程
关于安企神

word用VBA快速输入拼音

2024-10-28

公司上网行为管理,就用安企神软件

立即咨询

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

  • TAG: