Home |
Search |
Today's Posts |
#7
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
automatically update and display date at beginging of text in word | Microsoft Word Help | |||
How do I automatically update paragraph numbers in text (3 levels. | Microsoft Word Help | |||
Automatically Update Form Text Feild Calculations | Microsoft Word Help | |||
Automatically Update Form Text Fields | Microsoft Word Help | |||
How to automatically update TC field "marked text" | Microsoft Word Help |