2,461
社区成员
发帖
与我相关
我的任务
分享
Dim reg As Object
Set reg = CreateObject("vbscript.regexp")
reg.Global = True
reg.MultiLine = False
reg.Pattern = "(..)(..)(..)(..)(..)(.[^\r])"
Dim i As Integer
For i = ThisDocument.Paragraphs.Count To 1 Step -1
Dim objParagraph As Paragraph
Set objParagraph = ThisDocument.Paragraphs.Item(i)
objParagraph.Range.Text = reg.Replace(objParagraph.Range.Text, "$1,$2,$3,$4,$5,$6|")
Next
Dim zhs As Integer
zhs = ActiveDocument.BuiltInDocumentProperties(wdPropertyLines).Value
Dim js As Integer
For js = 1 To zhs
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "??"
.Replacement.Text = "^&,"
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Dim i As Integer
For i = 1 To 5
With Selection
If .Find.Forward = True Then
.Collapse Direction:=wdCollapseStart
Else
.Collapse Direction:=wdCollapseEnd
End If
.Find.Execute Replace:=wdReplaceOne
If .Find.Forward = True Then
.Collapse Direction:=wdCollapseEnd
Else
.Collapse Direction:=wdCollapseStart
End If
.Find.Execute
End With
Next
With Selection.Find
.Text = "??"
.Replacement.Text = "^&|"
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
With Selection
If .Find.Forward = True Then
.Collapse Direction:=wdCollapseStart
Else
.Collapse Direction:=wdCollapseEnd
End If
.Find.Execute Replace:=wdReplaceOne
If .Find.Forward = True Then
.Collapse Direction:=wdCollapseEnd
Else
.Collapse Direction:=wdCollapseStart
End If
.Find.Execute
End With
Selection.Find.Execute
Selection.Find.Execute
Next