I am doing a mailmerge from VB. I generate a CSV data file first and than
defile the mailmerge document. I would like to have a condition if the
country field is "United Kingdom" omit printing the country and instead have
the postcode.
if {mergefield country}="United Kingdom" {postcode} {country}
How can I do this in the following:
With .Fields
.Add oApp.Selection.Range, "Title"
oApp.Selection.TypeText " "
.Add oApp.Selection.Range, "Initials"
oApp.Selection.TypeText " "
.Add oApp.Selection.Range, "Surname"
oApp.Selection.TypeParagraph
.Add oApp.Selection.Range, "Add1"
oApp.Selection.TypeParagraph
.Add oApp.Selection.Range, "Add2"
oApp.Selection.TypeParagraph
.Add oApp.Selection.Range, "Add3"
oApp.Selection.TypeParagraph
.Add oApp.Selection.Range, "Town_zip"
oApp.Selection.TypeText " "
.Add oApp.Selection.Range, "PostCode"
oApp.Selection.TypeParagraph
.Add oApp.Selection.Range, "Country"
End With
Thanks
Jean-Guy Marcil - 17 Nov 2004 02:55 GMT
Mustapha Amrani was telling us:
Mustapha Amrani nous racontait que :
> I am doing a mailmerge from VB. I generate a CSV data file first and
> than defile the mailmerge document. I would like to have a condition
> if the country field is "United Kingdom" omit printing the country
> and instead have the postcode.
>
> if {mergefield country}="United Kingdom" {postcode} {country}
You will need to use nested fields.
See
http://word.mvps.org/faqs/macrosvba/NestedFieldsWithVBA.htm

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org