Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 08-17-2019, 05:40 PM
Visor Visor is offline Add bookmark with vba in the header Windows 10 Add bookmark with vba in the header Office 2013
Advanced Beginner
Add bookmark with vba in the header
 
Join Date: Aug 2019
Posts: 38
Visor is on a distinguished road
Default Add bookmark with vba in the header

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
Reply With Quote
 

Tags
vba



Similar Threads
Thread Thread Starter Forum Replies Last Post
Different Odd/Even Header with no header on first page of new chapters bbecker24 Word 4 05-09-2018 08:17 PM
Header Info: Connecting seclected items for 1st page Header into Following Pages SMHa Word 1 08-24-2016 10:00 AM
No Header bullsfan586 Word 1 08-29-2015 07:55 PM
How do I get this header? veed Word 7 04-10-2013 12:25 AM
How to get this header? msvis Word 1 12-04-2011 07:45 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:10 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft