视频教程中的代码:
Sub 英文符号替换为中文·联盈标讯()
Dim FindList() As Variant
Dim ReplaceList() As Variant
Dim i As Integer
Dim FindRange As Range
Dim Doc As Document
‘ 定义要替换的英文和中文符号列表
FindList = Array(“,”, “.”, “:”, “;”, “?”, “!”, “”””, “‘”, “(“, “)”, “[“, “]”, “{“, “}”, “<", ">“, “/”, “\”)
ReplaceList = Array(“,”, “。”, “:”, “;”, “?”, “!”, ““”, “””, “(”, “)”, “[”, “]”, “{”, “}”, “《”, “》”, “/”, “\”)
‘ 设置当前文档
Set Doc = ActiveDocument
‘ 遍历符号列表进行替换
For i = LBound(FindList) To UBound(FindList)
With Doc.Content.Find
.ClearFormatting
.Text = FindList(i)
.Replacement.ClearFormatting
.Replacement.Text = ReplaceList(i)
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute Replace:=wdReplaceAll
End With
Next i
‘ 提示用户替换完成
MsgBox “英文标点符号已替换为中文标点符号。”, vbInformation, “替换完成”
End Sub
特别提示:本产品为虚拟资源,购买后不退款不换货,谨慎购买。
评论0