Существует как минимум два способа обращения ко всем нижним колонтитулам документа Word:
- StoryRanges
- Sections.Footers
Пожалуйста, попробуйте это (ActiveDocument
ваш objWord
):
Private Sub CheckAllDocumentFooters()
Dim r As Word.Range
Dim s As Word.Section
Dim hf As Word.HeaderFooter
' either all story ranges:
For Each r In ActiveDocument.StoryRanges
Select Case r.StoryType
Case wdEvenPagesFooterStory, wdPrimaryFooterStory, wdFirstPageFooterStory
r.WholeStory
Debug.Print r.Text
End Select
' further sections:
While Not (r.NextStoryRange Is Nothing)
Set r = r.NextStoryRange
Select Case r.StoryType
Case wdEvenPagesFooterStory, wdPrimaryFooterStory, wdFirstPageFooterStory
r.WholeStory
Debug.Print r.Text
End Select
Wend
Next r
' or all sections:
For Each s In ActiveDocument.Sections
For Each hf In s.Footers
Debug.Print hf.Index
Debug.Print hf.Range.Text
Next hf
Next s
End Sub