The macro below inserts all text with style Heading 1 in a new document.
Another approach: create a Table of Contents (TOC) containing only Heading
1. The TOC is a field but you can convert it to normal text if you select the
TOC and press Ctrl+Shift+F9.
Sub ListHeading1Paras()
Dim oPara As Paragraph
Dim oDocH1 As Document
Dim oDoc As Document
Set oDoc = ActiveDocument
Set oDocH1 = Documents.Add
'Make sure oDocH1 starts empty and with style Normal
With oDocH1
.Range = ""
.Paragraphs(1).Style = oDoc.Styles(wdStyleNormal)
End With
'Iterate through all paragraphs in active document
'If style is Heading 1, insert text in oDocH1
For Each oPara In oDoc.Paragraphs
If oPara.Style = oDoc.Styles(wdStyleHeading1) Then
oDocH1.Range.InsertAfter oPara.Range.Text
End If
Next oPara
'Clean up
Set oDoc = Nothing
Set oDocH1 = Nothing
End Sub
--
Regards
Lene Fredborg - Microsoft MVP (Word)
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word
Post by DMc2007Hi
How can list all the text that uses style Heading 1?
Regards
D