Is is possible your ref fields aren't updating? Or that your bookmark is
getting wiped out by when you put the text at it (so there's no bookmark
left for your ref fields to see?) ALSO -- when I do this, I just use
multiple bookmarks, like "Recipient1", "Recipient2", "Recipient3" instead of
a cross reference field. That way, the person using the gets all text, and
no fields to confuse them, and I don't have to worry about updating fields.
Here are some code snippets for whatever route you take.
You can put the following line of code to update all fields in the body of
the document (this won't go into headers/footers, let me know if you need
to) after you fill in the bookmark:
activedocument.fiels.update
If you want to make sure you only update your ref fields, use something like
this:
' declare a variable of type Field
Dim fldTheText As Field
' look at each field in the doc, if it's a ref field, update it
For Each fldTheText In ActiveDocument.Fields
If fldTheText.Type = wdFieldRef Then
fldTheText.Update
End If
Next fldTheText
When you complete the bookmark, replace it in the document so it's still
there for the reference field to see.
This code puts the text at the bookmark range and then puts the bookmark
back around the text.
'declare a range variable to be the bookmark range
Dim rngBookmark As Range
'set that variable to the bookmark range
Set rngBookmark = ActiveDocument.Bookmarks("BookmarkName").Range
'put the text at the bookmark range
rngBookmark.Text = "theText"
'Puts the bookmark back in the doc for future use in case it got wiped out.
ActiveDocument.Bookmarks.Add "BookmarkName", rngBookmark
I'm not sure if i'm doing it right, but i'm using {REF
Bookmark_Title} just like you said and when i run the
macro, it doesn't do anything. The online help says to
pretty much do exactly what you suggested, but it's not
working, do i have to put an incerpt in my code or
something, or should it be able to run of itself? thanks
again in advance
~q