Thanks for your response. That makes sense, but how do I automate the
process? How can I make it reflect the correct paragraph context each time
the macro is run?
Here is the new code:
With ActiveDocument.Bookmarks
.Add Range:=Selection.Range, Name:="b"
.DefaultSorting = wdSortByLocation
.ShowHidden = True
End With
Selection.InsertCrossReference ReferenceType:="Bookmark",
ReferenceKind:= _
wdNumberFullContext, ReferenceItem:="b", InsertAsHyperlink:=True, _
IncludePosition:=False
End Sub
Is there a way to generate a new bookmark Name (in this case "b") and copy
it to the ReferenceItem (b) each time the macro is run?
> Thanks for your response. That makes sense, but how do I automate the
> process? How can I make it reflect the correct paragraph context each time
[quoted text clipped - 22 lines]
> > >
> > > Any help on this would be greatly appreciated.
Russ - 30 Jul 2006 08:34 GMT
Kurtis,
You could try:
Dim n as Long
Dim myBookmark as String
n = ActiveDocument.Bookmarks.Count + 1
myBookmark = "b" & Cstr(n)
Then replace "b" in your code below with the variable myBookmark, verbatim
(without quotation marks), in both places.
> Here is the new code:
>
[quoted text clipped - 38 lines]
>>>>
>>>> Any help on this would be greatly appreciated.

Signature
Russ
drsmN0SPAMikleAThotmailD0Tcom.INVALID
Kurtis - 31 Jul 2006 14:15 GMT
Russ, that worked! Thank you very much for helping me about.
> Kurtis,
>
[quoted text clipped - 50 lines]
> >>>>
> >>>> Any help on this would be greatly appreciated.
Mickey - 01 Nov 2007 22:53 GMT
I know I'm getting into this late but could this code be modified to create a
cross reference based on existing bookmarks in the document. The situation
is this....I have multiple headers in a document due to portrait and
landscape pages. There are 4 bookmarks in the header (DOC_NAME, DOC_VERSION,
DOC_TITLE, DOC_SITE). The headers each need the same bookmarks. I have a
macro to add the bookmarks but the bookmarks are only retained in the last
header. I'm wondering if I can search the headers where the bookmark was
lost and include cross reference code. For example, search for "[DOC_NAME]
and have code that cross references it to the bookmark DOC_NAME.
Any help is very much appreciated.
Thanks,
Mickey
> Kurtis,
>
[quoted text clipped - 50 lines]
> >>>>
> >>>> Any help on this would be greatly appreciated.
Russ - 04 Nov 2007 07:43 GMT
Mickey,
I think your question was answered by Tony in the other thread:
"Retaining Bookmarks in Autotext Macros"
> I know I'm getting into this late but could this code be modified to create a
> cross reference based on existing bookmarks in the document. The situation
[quoted text clipped - 66 lines]
>>>>>>
>>>>>> Any help on this would be greatly appreciated.

Signature
Russ
drsmN0SPAMikleAThotmailD0Tcom.INVALID
Helmut Weber - 30 Jul 2006 08:47 GMT
Hi Kurtis
as far as I see, you are inserting a crossreference
to a bookmark in the bookmark [] or adjacent ][ to it.
Doesn't make sense to me.

Signature
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"