{IF {DUPLICATE} = "on" "{MERGEFIELD Name}" "" }
Any ideas would be greatly appreciated, if you dont understand what i'm
trying to achieve, please contact me.
Many thanks in advance;
Chris...
The following should create the nested field that you gave as an example.
------------------------------------------------------------
Public Sub NestedFields()
ActiveWindow.View.ShowFieldCodes = True
Set myField = ActiveDocument.Fields.Add _
(Range:=Selection.Range, Type:=wdFieldEmpty)
With ActiveDocument.Fields(1)
.Code.Text = ""
.Code.Select
Selection.InsertAfter "If "
Selection.Collapse direction:=wdCollapseEnd
Set myField1 = .Code.Fields.Add _
(Range:=Selection.Range, Type:=wdFieldEmpty)
Selection.InsertAfter " = " & Chr(34) & _
"on" & Chr(34) & " " & Chr(34)
Selection.Collapse direction:=wdCollapseEnd
Set myField2 = .Code.Fields.Add _
(Range:=Selection.Range, Type:=wdFieldEmpty)
Selection.InsertAfter Chr(34) & _
" " & Chr(34) & Chr(34)
With myField1
.Code.Text = ""
.Code.Select
Selection.InsertAfter "DUPLICATE"
End With
With myField2
.Code.Text = ""
.Code.Select
Selection.InsertAfter "MERGEFIELD Name"
End With
End With
'ActiveWindow.View.ShowFieldCodes = False
End Sub
----------------------------------------------------------
I don't work much with fields, so I haven't tested whether the field created
returns a valid result. Let us know. Please post any replies to the
newsgroup.
Hope it helps.
Chris Webb <chris...@zoom.co.uk> wrote in message
news:7sqkn5$uh$1...@taliesin2.netcom.net.uk...