View Single Post
 
Old 06-29-2011, 07:30 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,372
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