I've created a 13 page form which reuses several pieces of data throughout.
I've created a userform interface to the form template to gather the data and
disperse the data throughout the document after opening the template.
I've created bookmarks to correspond to the data, using the [] method of
creating bookmarks. In every subsequent reference to the bookmark (where I
want the bookmark to expand the data to what's entered on the userform) I've
used cross-references.
However, consistently only the first field referenced gets updated. All of
the other fields remain as the cross reference { REF BName \h }, rather than
expanding to the name entered in the BName field on the userform.
I've used Greg Maxey's code in the userform
With ActiveDocument
.Bookmarks("Text1").Range.InsertBefore TextBox1
.Bookmarks("Text2").Range.InsertBefore TextBox2
... etc.
End With
UserForm1.Hide
and used the autonew macro for the create button with UserForm1.Show to
execute upon the click of the create button.
I feel like I'm missing something huge here ... like asking it to update ALL
fields throughout the document.
This is my first template, my first userform, my first bookmark, and my
first crossreference use. Any ideas?
--Mary
Greg Maxey - 05 Feb 2007 09:01 GMT
Mary,
> I've used Greg Maxey's code in the userform
Greg Maxey doesn't remember where or when he posted that code. I don't
completely understand what you have done in your document, but the
statement:
.Bookmarks("Text1").Range.InsertBefore TextBox1
Doesnt' put in text "in" the bookmark. Try:
Sub Test()
Dim oRng As Word.Range
With ActiveDocument
Set oRng = .Bookmarks("Text1").Range
oRng.Text = TextBox1
.Bookmarks.Add "Text1", oRng
Set oRng = .Bookmarks("Text2").Range
oRng.Text = TextBox2
.Bookmarks.Add "Text2", oRng
End With
UserForm1.Hide
End Sub

Signature
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.
> I've created a 13 page form which reuses several pieces of data
> throughout.
[quoted text clipped - 34 lines]
>
> --Mary
Peter Jamieson - 05 Feb 2007 14:17 GMT
\h hides the result so you may need to get trid of that too.
Peter Jamieson
> I've created a 13 page form which reuses several pieces of data
> throughout.
[quoted text clipped - 34 lines]
>
> --Mary