Rufen Sie die folgende Funktion auf, um zu ermitteln, ob das Inhaltssteuerungs-Tag in einem Header-Bereich vorhanden ist.
Code:
Function CCExistsInHeader(sTag As String) As Boolean
Dim oSection As Section
Dim oHeader As HeaderFooter
Dim oCC As ContentControl
For Each oSection In ActiveDocument.Sections
For Each oHeader In oSection.Headers
If oHeader.Exists Then
For Each oCC In oHeader.Range.ContentControls
If oCC.Tag = sTag Then
CCExistsInHeader = True
GoTo lbl_Exit
End If
Next oCC
End If
Next oHeader
Next oSection
lbl_Exit:
Set oSection = Nothing
Set oHeader = Nothing
Set oCC = Nothing
Exit Function
End Function