document.selection.SelectAll strSource = document.selection.Text Set objRE = New RegExp objRE.Pattern = "固定の文字列\s(.*)\r\n(.*)\r\n" objRE.Global = True Set Matches = objRE.Execute(strSource) For i = 0 to Matches.Count -1 str = str & Matches.Item(i).SubMatches(0) & " " & Matches.Item(i).SubMatches(1) & " " If Instr((i + 1) / 3, ".") = 0 Or i = Matches.Count -1 Then str = Left(str, Len(str) - 1) & vbCrLf End If Next If Not str = "" Then document.selection.Delete document.write str End If