Greetings friends of the forum, this time I raise the present problem.
when opening the document I want to place a bookmark in the header with vba but from the second page and then from three spaces.
HTML Code:
Sub addBM_Header()
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
ActiveDocument.ActivePane.View.NextHeaderFooter
ActiveDocument.Sections(1).headers (wdHeaderFooterPrimary)
Selection.MoveRight Unit:=wdCharacter, Count:=4
ActiveDocument.Bookmarks.Add Name:="NombreEncab", Range:=Selection.Range
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub
I have the macro that I attached but when executing it at the end it shows me an error because it doesn't find any more pages
this is
HTML Code:
ActiveDocument.Sections(1).headers(wdHeaderFooterPrimary).Bookmarks.Add Range:=Selection.Range, Name:="NombreEncab"
something like this does not work in bookmark but if I only put text in the header
How can I solve this?
Thanks in advance for the support