View Single Post
 
Old 12-16-2022, 03:12 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,142
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

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
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote