Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating with VB

Status
Not open for further replies.

weeze2

Technical User
Joined
Jun 18, 2002
Messages
129
Location
DK
Hi
I have a MSWord documents that contains merge fields and it works fine. But if the documents are put as links in another document (being opened from another document), a textarea/field containing merge fields gives an error because they are not updated.
If I markup the mergefields in the textbox and click on update fields, they get updated with the right data.

I then tried to update the fields with a makro that contains the code:
'
For Each l_section In ActiveDocument.Sections
l_section.Range.Fields.Update
Next l_section
'
when I run the makro, it seems as if something is happening, and the textbox blinks slightly but the fields does not update.

Does anyone know how I can update these fields?

Thanks
 
Hi again..

Just want to add that

ActiveDocument.Fields.Update

doesn't get to it either.

For some reason the field doesnt get updated when opened from another word doc.

Is there some way to Select the textbox/area with VB.
It might be that
Selection.Fields.Update might work.
 
Hi
I got it..eventually :)

For i = 1 To ActiveDocument.Shapes.Count
ActiveDocument.Shapes.Item(i).TextFrame.TextRange.Select
Selection.Fields.Update
Next i
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top