Attribute VB_Name = "M" Sub 注記抽出() Dim sTargetStr, sConStr As String Dim re As VBScript_RegExp_55.RegExp Dim str Set str = Application.Documents.Item(1).Content Set re = New VBScript_RegExp_55.RegExp With re .Pattern = "〈.+?〉" .Global = True .IgnoreCase = True .MultiLine = True End With Set matches = re.Execute(str) With re i = 1 For Each Match In matches sTargetStr = i & Space(1) & Match.Value If i > 9 Then sTargetStr = "《" & i & "》" & Space(1) & Match.Value End If sConStr = sConStr & sTargetStr & Chr(9) i = i + 1 Next End With With Selection .Collapse .MoveDown Unit:=wdLine, Count:=1 .Text = sConStr End With With Selection.Find .Text = "〈注─" .Replacement.Text = " " .Forward = True .Execute Replace:=wdReplaceAll .Text = "〉" .Replacement.Text = " " .Forward = True .Execute Replace:=wdReplaceAll End With With Selection .Range.CharacterWidth = wdWidthFullWidth With .Font .Name = "MS P明朝" .Size = 9 End With With .ParagraphFormat .LineSpacingRule = wdLineSpaceExactly .LineSpacing = 11 End With .Collapse End With End Sub