iandavies147
Technical User
Hi
Is it possible to add a condition to a word document so that you dont display a word mail merge datafield if it has a certain string contained in the datafield for example a comma?
strValue = ActiveDocument.MailMerge.DataSource.DataFields("CUSTOMER")
if instr(strValue,",") > 0 then
ActiveDocument.MailMerge.DataSource.DataFields("CUSTOMER") = ""
end if
This code generates an error reporting that it is an "improper use of property", I know you can add conditions in the code that use mergfields but I can't see how these can be used with instr?
e.g. {IF {MERGEFIELD CUSTOMER} = "UK" "British" "Not British"}
Is it possible to add a condition to a word document so that you dont display a word mail merge datafield if it has a certain string contained in the datafield for example a comma?
strValue = ActiveDocument.MailMerge.DataSource.DataFields("CUSTOMER")
if instr(strValue,",") > 0 then
ActiveDocument.MailMerge.DataSource.DataFields("CUSTOMER") = ""
end if
This code generates an error reporting that it is an "improper use of property", I know you can add conditions in the code that use mergfields but I can't see how these can be used with instr?
e.g. {IF {MERGEFIELD CUSTOMER} = "UK" "British" "Not British"}