Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 06-29-2011, 07:30 PM
macropod's Avatar
macropod macropod is offline Replace all occurrences of one merge field with plain text Windows 7 64bit Replace all occurrences of one merge field with plain text Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,527
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi blankenhorst,

You could use a macro like:
Code:
Sub Demo()
Dim oFld As Field
For Each oFld In ActiveDocument.Fields
  With oFld
    If .Type = wdFieldMergeField Then
      If Trim(Replace(Replace(.Code, "MERGEFIELD", ""), Chr(34), "")) = "MyFieldName" Then .Unlink
    End If
  End With
Next
End Sub
or:
Code:
Sub Demo()
Dim oFld As Field
For Each oFld In ActiveDocument.Fields
  With oFld
    If .Type = wdFieldMergeField Then
      If Trim(Replace(Replace(.Code, "MERGEFIELD", ""), Chr(34), "")) = "MyFieldName" Then
        .Code.Text = "QUOTE " & Chr(34) & "My Text" & Chr(34)
        .Update
        .Unlink
      End If
    End If
  End With
Next
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Replace all occurrences of one merge field with plain text Html send as plain text JosSchaars Outlook 5 12-21-2010 02:51 PM
Replace all occurrences of one merge field with plain text Selecting merge field based on whether or not text is present amym Mail Merge 1 12-07-2010 05:14 AM
Replace All with plain text containing subscript DeaducK Word 0 06-24-2010 08:16 PM
merge field formatting problem with "text to be inserted before" wissam Mail Merge 0 12-13-2009 12:50 AM
Text field after word merge in Word 2000 brianlb Word 1 06-29-2009 07:50 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:02 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft