|
本帖最后由 dongdonggege 于 2018-7-23 23:20 编辑
楼主的22楼《英文标点转中文》程序,在第8行《Do While Selection.Find.Execute(findtext:=a(i), Forward:=True)》,在没有for i=……next情况下,a(i)是会出错的。- Sub 英文标点转中文()
- Dim i As Long, a, b
- a = Array(".", ",")
- b = Array("。", ",")
- Do
- Selection.HomeKey Unit:=wdStory
- Selection.Find.ClearFormatting
- For i = 0 To UBound(a) - 1
- Do While Selection.Find.Execute(findtext:=a(i), Forward:=True)
- Selection.MoveStart Unit:=wdCharacter, Count:=-1
- If Selection.Characters.First Like "[!0-9a-zA-Z0-9a-zA-Z]" Then Selection.Characters.Last.Text = b(i)
- Selection.MoveRight Unit:=wdCharacter, Count:=1
- Loop
- Next
- i = i + 1
- Loop Until i = 2
- End Sub
复制代码 是这样的吗?
|
|