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

Re: repeating data not updating all fields, only first by Greg

Greg
Mon Feb 05 03:01:05 CST 2007

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


--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

"Mary B." <Mary B.@discussions.microsoft.com> wrote in message
news:2C5365F6-8CC3-4709-8D2E-01D37458FF46@microsoft.com...
> 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
>
>



Re: repeating data not updating all fields, only first by Peter

Peter
Mon Feb 05 08:17:48 CST 2007

\h hides the result so you may need to get trid of that too.

Peter Jamieson

"Mary B." <Mary B.@discussions.microsoft.com> wrote in message
news:2C5365F6-8CC3-4709-8D2E-01D37458FF46@microsoft.com...
> 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
>
>