• Word – find text, replace with mergefield

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » Word – find text, replace with mergefield

    Author
    Topic
    #471461

    I have a document which, on first glance, appears to contain a number of fields; however, closer inspection reveals the ‘fields’ are just text surrounded by double angle quotes.

    Many of the ‘fields’ appear multiple times throughout the document.

    I need to replace all occurences of text contained with <> with a mergefield of the same name but don’t know how to go about it. Any ideas?

    Viewing 0 reply threads
    Author
    Replies
    • #1243932

      Hi Darsha,

      Short of writing a macro – which would be more effort than it’s worth for something that might only be used a few times, you could use Find/Replace.

      For example, suppose you want to replace all instances of <> with the corresponding mergefield (or another field for that matter). The first step is to insert an instance of the actual field you want to use, perhaps next to the string you want to replace. Then, copy the <> string and paste it into the Find box on the Find/Replace dialogue box. Switch back to the document and cut out the mergefield you inserted. Return to the Find/Replace dialogue box and insert ^c into the Replace box. Finally, click ‘Replace all’. Repeat as necessary for the other field strings.

      Cheers,
      Paul Edstein
      [Fmr MS MVP - Word]

    Viewing 0 reply threads
    Reply To: Word – find text, replace with mergefield

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: