Reply to Message

Solution
I have written the macro that removes EndNote field codes (converts EndNote fields to text) in current Word document not only in endnotes and footnotes, but also in Shapes.
This macro identifyes EndNote fields by it's type - ADDIN.
That is the code:
------- code --------------------
Sub RemoveAddin_FieldCodes()
nResult = VBA.Interaction.MsgBox("Вы уверены, хотите удалить все коды полей типа ADDIN?", vbOKCancel, "Действие необратимо!")
If nResult = vbOK Then
Dim doc As Document
Dim fld As Field
Dim ftnt As Footnote
Dim endnt As Endnote
Dim shp As Shape
Dim shp2 As Shape
Dim shp3 As Shape
Set doc = ActiveDocument
ActiveDocument.ActiveWindow.View.ShowFieldCodes = False
For Each fld In doc.Fields
' fld.Result.Select
If fld.Type = wdFieldAddin Then
fld.Unlink
End If
Next fld
For Each ftnt In doc.Footnotes
For Each fld In ftnt.Range.Fields
' fld.Result.Select
If fld.Type = wdFieldAddin Then
fld.Unlink
End If
Next fld
Next ftnt
For Each endnt In doc.Endnotes
For Each fld In endnt.Range.Fields
' fld.Result.Select
If fld.Type = wdFieldAddin Then
fld.Unlink
End If
Next fld
Next endnt
For Each shp In doc.Shapes
If shp.Type = msoTextBox Then
For Each fld In shp.TextFrame.TextRange.Fields
' fld.Result.Select
If fld.Type = wdFieldAddin Then
fld.Unlink
End If
Next fld
End If
If shp.Type = msoGroup Then
For Each shp2 In shp.GroupItems
If shp2.Type = msoTextBox Then
For Each fld In shp2.TextFrame.TextRange.Fields
' fld.Result.Select
If fld.Type = wdFieldAddin Then
fld.Unlink
End If
Next fld
End If
Next shp2
End If
If shp.Type = msoCanvas Then
For Each shp2 In shp.CanvasItems
If shp2.Type = msoTextBox Then
For Each fld In shp2.TextFrame.TextRange.Fields
' fld.Result.Select
If fld.Type = wdFieldAddin Then
fld.Unlink
End If
Next fld
End If
If shp2.Type = msoGroup Then
For Each shp3 In shp2.GroupItems
If shp3.Type = msoTextBox Then
For Each fld In shp3.TextFrame.TextRange.Fields
' fld.Result.Select
If fld.Type = wdFieldAddin Then
fld.Unlink
End If
Next fld
End If
Next shp3
End If
Next shp2
End If
Next shp
Set fld = Nothing
Set ftnt = Nothing
Set doc = Nothing
Set shp = Nothing
Set shp2 = Nothing
Set shp3 = Nothing
End If
End Sub
-----------code----------------
Posted by popkov@...
Updated - 7th May 2007