Hi G.G.Yagoda
Try this
Dim oRange as Range
Set oRange = ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary) _
.Range.Bookmarks("test").Range
oRange.Text = "Insert text here"
ActiveDocument.Bookmarks.Add Name:="test", Range:=oRange
--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Hard to believe there've been no nibbles on this one.
I inherited a template with bookmarks buried inside cell 2 of a table
buried inside the first-page header. After changing the bookmark text,
I cannot "add" the bookmark the way it can be added in the main
document.
Dave Lett wrote this concerning the problem:
"You need to access the story range the header is in. With Word, that
can be the first page header, the even page header(s), or the primary
(odd) page header(s). You can use something like the following:
ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary) _
..Range.Bookmarks("test").Range.text = "Insert text here"
Unfortunately, changing that line of code to "add" the bookmark doesn't
work. Nor does:
ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary) _
..Range.Tables(1).Range.Cells(2).Range.Bookmarks.Add
Nor does:
ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary) _
..Range.Tables(1).Range.Bookmarks.Add
There must be *some* way to restore the bookmark in headers/footers
after changing its contents. What am I missing here? Grateful for any
and all input.