-
Can anyone confirm that this procedure would be skipping any linked header, and process only "parent" headers?
Dim oHF As HeaderFooter
Dim oSection As Section
Dim LinkToPreviousFlag As Integer
For Each oSection In ActiveDocument.Sections
For Each oHF In oSection.Headers
LinkToPreviousFlag = 0
If oSection.Headers(wdHeaderFooterPrimary).LinkToPrevious = True Then
LinkToPreviousFlag = 1
ElseIf oSection.Headers(wdHeaderFooterFirstPage).LinkToPrevious = True Then
LinkToPreviousFlag = 1
ElseIf oSection.Headers(wdHeaderFooterEvenPages).LinkToPrevious = True Then
LinkToPreviousFlag = 1
End If
If LinkToPreviousFlag = 0 Then 'process only the section if it is not linked to the previous one
oHF.Range.Select
'process whatever is required
End If
Next oHF
Next oSection
Please advise!
Also, I am wondering if there is a way to match the "section number" oSection with the corresponding section in Word? I noticed that this procedure gives more sections than the actual Word doc contains. I assume this is because each header/footer is considered as a unique section, which is not the same as a Word section.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules