Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Anderflash Anderflash is offline
external usenet poster
 
Posts: 26
Default Update automatically text from another

Good, but if I replace the text field to a pure text, I will not have the
event 'on exit'. In other words, I don't have an event 'change' in the
document like worksheet_change from the excel and 'on exit' to the pure text.
In that case, I would need the user manipulation (a button or shortcut key)
to activate the bookmark's updating procedure.
But thanks for the information. I don't know if the Word VBA is too
important for me like Excel/Access VBA, but I liked the learning.

"Peter Jamieson" wrote:

-Why does only the function "activedocument.fields.update" not work?


Because although it sounds as if it will update /all/ the fields in the
document (and aI wish it did do that because everythign would be much
simpler), "activedocument.fields" only references the "main" story. (Well,
actually it may reference more stories than that, but that's what I think it
does).

-Is there a solution without using the text field (using only pure text on
the body)?


You could /probably/ do it by bookmarking the text (you could do this for
the header as well) and using the macro to replace the text. Because the
operation destroys the bookmark, you have to replace it. However, I haven't
tested it so don't take my word for it!

Let's suppose you have a bookmark on page 2 called page2bm and a bookmark in
the header called headerbm, then the following would probably do it:

Sub UpdateMyBMs()
UpdateBookmark "page2bm", ActiveDocument.Bookmarks("the name of your text
form field").Range.Text
UpdateBookmark "headerbm", ActiveDocument.Bookmarks("the name of your text
form field").Range.Text
End Sub

Sub UpdateBookmark(BookmarkToUpdate As String, TextToUse As String)
Dim BMRange As Range
Set BMRange = ActiveDocument.Bookmarks(BookmarkToUpdate).Range
BMRange.Text = TextToUse
ActiveDocument.Bookmarks.Add BookmarkToUpdate, BMRange
End Sub

The above macro is adapted from Dave Rado's page at

http://word.mvps.org/faqs/macrosvba/...AtBookmark.htm

Peter Jamieson

"Anderflash" wrote in message
...
Great, I did, thanks. Two questions:
-Why does only the function "activedocument.fields.update" not work?
-Is there a solution without using the text field (using only pure text on
the body)?



 
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
automatically update and display date at beginging of text in word Tim Microsoft Word Help 2 December 16th 05 06:50 AM
How do I automatically update paragraph numbers in text (3 levels. [email protected] Microsoft Word Help 1 September 14th 05 07:33 PM
Automatically Update Form Text Feild Calculations Brendan Vassallo Microsoft Word Help 1 May 8th 05 07:51 PM
Automatically Update Form Text Fields Brendan Vassallo Microsoft Word Help 3 May 4th 05 05:35 AM
How to automatically update TC field "marked text" wmcdan9569 Microsoft Word Help 3 April 25th 05 08:22 AM


All times are GMT +1. The time now is 01:02 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"