For i = 1 To n 'n是listview1的行数
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ListView1.ListItems(i).SubItems(0) 'Findstr=listview1的第i行第1列对应单元格的内容
.Replacement.Text = ListView1.ListItems(i).SubItems(1) 'Findstr=listview1的第i行第2列对应单元格的内容
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
ListView1.selectedItem = i
Next
MsgBox "处理完毕!", vbInformation + vbOKOnly, "消息"
ListView1.selectedItem = 1