getting the Heading Text of a paragraph

T

twinkler

Dear all,

I have a macro whicht extracts changes from a document and puts them
into a new document. The information I've got from the Revision object
includes line no. and page.

I would like to inlcude the text of the previous (higher) heading,
too. I guess this would be the previous element with a lower outline
number?

While not new to VBA I am new to Word Coding and hence would
appreciate a way on how to get the heading text from a given point in
a Word document.

I am using Word 2002.

Cheers

Torsten
 
S

StevenM

To: Twinkler,

ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range.Text

Steven Craig Miller
 
H

Helmut Weber

Hi Torsten,

maybe you can adjust the following to your needs:

Sub Makro5()
Dim rTmp As Range
Dim Level As Long
Level = Selection.Paragraphs(1).OutlineLevel
Set rTmp = ActiveDocument.Range
rTmp.End = Selection.start
With rTmp.Find
.ParagraphFormat.OutlineLevel = Level - 1
.Forward = False
If .Execute Then
MsgBox rTmp.Text
End If
End With

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top