好友
阅读权限30
听众
最后登录1970-1-1
|
试试这2个宏,从慧办公的插件里抄来了常用的标点符号,另外英文没有顿号,可以忽略;另外慧办公插件里也有这个功能,只是它替换的是全文(包括页眉页脚部分),会员还能使用批量文档替换),我试了可以用。
Sub 英文转中文标点()
Dim selRange As Range
Set selRange = Selection.Range
Dim ywbd As Variant
Dim zwbd As Variant
Dim i As Integer
ywbd = Array("、", ".", ",", ";", ":", "?", "!", "…", "-", "~", "(", ")", "<", ">", "[", "]") '英文标点数组
zwbd = Array("、", "。", ",", ";", ":", "?", "!", "……", "—", "~", "(", ")", "《", "》", "【", "】") '对应中文标点数组
For i = LBound(ywbd) To UBound(ywbd)
With selRange.Find
.ClearFormatting
.Text = ywbd(i)
.Replacement.Text = zwbd(i)
.Execute Replace:=wdReplaceAll
End With
Next i
End Sub
Sub 中文转英文标点()
Dim selRange As Range
Set selRange = Selection.Range
Dim ywbd As Variant
Dim zwbd As Variant
Dim i As Integer
ywbd = Array("、", ".", ",", ";", ":", "?", "!", "…", "-", "~", "(", ")", "<", ">", "[", "]") '英文标点数组
zwbd = Array("、", "。", ",", ";", ":", "?", "!", "……", "—", "~", "(", ")", "《", "》", "【", "】") '对应中文标点数组
For i = LBound(ywbd) To UBound(ywbd)
With selRange.Find
.ClearFormatting
.Text = zwbd(i)
.Replacement.Text = ywbd(i)
.Execute Replace:=wdReplaceAll
End With
Next i
End Sub
|
|