M
Mike Cook
I'd like to locate Heading 1 items and select the text between them, and do this consecutively from the beginning to end of a Word document.
I've been using the following in a VBA macro, but need help with the guts of the loop. It finds the Headings, but I can't figure out how to select the text from one to the next.
Thanks for any help,
Mike
Selection.GoTo What:=wdGoToCharacter, Which:=wdGoToAbsolute, Count:=1
For Each oPara In ActiveDocument.Paragraphs
' Want to move to next Heading
Selection.MoveDown Unit:=wdParagraph, Count:=1, Extend:=wdExtend
If oPara.Style = "Heading 1" Then
' Somehow select text from previous Heading
Selection.Range.Copy
End If
Next oPara
I've been using the following in a VBA macro, but need help with the guts of the loop. It finds the Headings, but I can't figure out how to select the text from one to the next.
Thanks for any help,
Mike
Selection.GoTo What:=wdGoToCharacter, Which:=wdGoToAbsolute, Count:=1
For Each oPara In ActiveDocument.Paragraphs
' Want to move to next Heading
Selection.MoveDown Unit:=wdParagraph, Count:=1, Extend:=wdExtend
If oPara.Style = "Heading 1" Then
' Somehow select text from previous Heading
Selection.Range.Copy
End If
Next oPara