Hi, macropod
Do you know other ways to get all headers from the word document?
At first, I wanted to go through the word document using page by page. However, I have searched online and found out that I can't do that as Word is not a page layout software.
I have also tried using StoryRanges.
Code:
Sub getHeader()
Dim oStory As Range
MakeHValid
For Each oStory In ActiveDocument.StoryRanges
Do
If oStory.StoryType = wdPrimaryHeaderStory Then
MsgBox "There is a header"
MsgBox oStory
End If
Get next linked story
Set oStory = oStory.NextStoryRange
Loop Until oStory Is Nothing
Next
End Sub
Public Sub MakeHValid()
Dim lngjunk As Long
lngjunk = ActiveDocument.Range.StoryType
End Sub
Code:
MsgBox ActiveDocument.StoryRanges(wdPrimaryHeaderStory)
However, it did not work. The second code only gives me one of the headers text.
Thus, I am thinking if there is any way to get all the headers.
Thank you for your help