kerrypnx
7/9/2018 - 9:32 AM

批量选单词开头的段落18-7-9

批量选单词开头的段落18-7-9

Sub document_1()
selection.HomeKey wdStory
With selection.Find
  .Text = "X[!^13]@^13Y"
  .MatchWildcards = True
  .Execute
  
End With
selection.MoveRight wdCharacter, 1
selection.Paragraphs(1).Range.Select
Dim myrange As Range
Set myrange = ActiveDocument.Range(0, selection.Range.End)
myrange.Select
Dim a As Long
a = myrange.Paragraphs.count

selection.collapse wdCollapseEnd
With selection.Find
  .Text = "Y[!^13]@^13Z"
  .MatchWildcards = True
  .Execute
  
End With
selection.MoveRight wdCharacter, 1
selection.Paragraphs(1).Range.Select
Dim myrange1 As Range
Set myrange1 = ActiveDocument.Range(0, selection.Range.End)
myrange1.Select
Dim b As Long
b = myrange1.Paragraphs.count



Dim aimrng  As Range
Set aimrng = ActiveDocument.Range(ActiveDocument.Paragraphs(a).Range.Start, ActiveDocument.Paragraphs(b).Range.End)
aimrng.Select


End Sub