View Single Post
 
Old 08-17-2019, 08:08 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,144
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

The following will put the bookmark in the main header of the first section after the third character if there is one. (If you want it to start from page 2, then you will either need a section break and make it Sections(2) or have a different first page header.
Code:
Sub addBM_Header()
Dim oRng As Range
    Set oRng = ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range
    If Len(oRng) > 3 Then
        oRng.Start = oRng.Start + 3
        oRng.Collapse 1
    End If
    ActiveDocument.Bookmarks.Add Range:=oRng, Name:="NombreEncab"
End Sub
__________________
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