Home |
Search |
Today's Posts |
#4
|
|||
|
|||
There is a difference between unlink and lock. The difference is that
locking maintains the field structure and you can later unlock. This may not matter with what you are doing. For me, it often does matter. Unlinking, essentially, is permanent. On the other hand, it is a method rather than a property. -- Charles Kenyon Word New User FAQ & Web Directory: http://addbalance.com/word Intermediate User's Guide to Microsoft Word (supplemented version of Microsoft's Legal Users' Guide) http://addbalance.com/usersguide See also the MVP FAQ: http://www.mvps.org/word which is awesome! --------- --------- --------- --------- --------- --------- This message is posted to a newsgroup. Please post replies and questions to the newsgroup so that others can learn from my ignorance and your wisdom. "S.P." wrote in message ... Thank you so much! I found your own (!) examples at http://www.addbalance.com/word/faq_s...m#updatefields The solution was the "StoryRanges", and the nested loop Here's the working Script: Set MM = ActiveDocument.MailMerge MM.OpenDataSource Name:="c:\pdb.mer" MM.ViewMailMergeFieldCodes = False MM.DataSource.Close For Each SR In ActiveDocument.StoryRanges For Each F In SR.Fields If F.Type = wdFieldMergeField Then F.Unlink End If Next F Next SR End Sub "Charles Kenyon" schrieb im Newsbeitrag ... The following works for Ref field updating and should give you a leg up. Private Sub RefFieldUpdateAllStory() ' Written by Charles Kyle Kenyon 15 November 2001 ' repaired by Jezebel ' All Story Field Updater - Ref fields Dim oField As Field Dim oStory As Range ' For Each oStory In ActiveDocument.StoryRanges ' This goes into headers and footers as well as the regular document Do For Each oField In oStory.Fields If oField.Type = wdFieldRef Then oField.Update End If Next oField Set oStory = oStory.Next Loop Until oStory Is Nothing Next oStory End Sub -- Charles Kenyon Word New User FAQ & Web Directory: http://addbalance.com/word Intermediate User's Guide to Microsoft Word (supplemented version of Microsoft's Legal Users' Guide) http://addbalance.com/usersguide See also the MVP FAQ: http://www.mvps.org/word which is awesome! --------- --------- --------- --------- --------- --------- This message is posted to a newsgroup. Please post replies and questions to the newsgroup so that others can learn from my ignorance and your wisdom. "S.P." wrote in message ... I want to do a one-time (no update) MailMerge, into the existing document. The permanent "locking" almost works with Set myFields = ActiveDocument.Fields ' or ActiveDocument.MailMerge.Fields ?!? For Each fn in myFields If fn.type = wdFieldMergeField Then fn.Unlink End If Next fn Problem: the Fields in the header are not affected (which is good for page numbers...but for that I have the " If fn.type = ..." ). -- How can I unlink Mergefields in headers? I just can't find the ActiveDocument.Fields equivalent for headers. |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Page Number and Page header on the first page | Formatting Long Documents | |||
Header changes with text outside of header | Microsoft Word Help | |||
Header and Footer | Microsoft Word Help | |||
How do I reformat a header on page 2 to be different from the hea. | Microsoft Word Help | |||
Same header but even/odd footer (sorry for the new thread) | Page Layout |