PDA

View Full Version : Replace field values in Mailings through VBA



majkl.lowec
04-21-2012, 06:15 AM
Hi,


I am facing one problem concerning mailings and fields in MS Words.:dunno


I have in MS Excel source column with header <<state>> an 20 variants for what should be code of state replaced in mass mailings in MS Word. For example if it is FR, then field should be substitute by France, DE = Germany, SP = Spain, PO = Poland, etc.


I don’t want to use 20 times “if-then” formulas for field like {IF state = "PO" "Poland" ""} one after another because even space in Document is too small.:banghead:


Is there any easy solution for Macro Visual Basic - some select/switch statement? Would be applicable then all records for mailing? Can you show how to deal with it.


Thanks a lot!:hi:

macropod
04-21-2012, 03:57 PM
Hi majkl.lowec,

I don't understand you comment about 'even space in Document is too small'. IF fields take up no space at all (unless you have the field code display toggled 'on' - and even then they don't affect the output).
If you don't want IF fields in the mailmerge main document, you could:
• alter the data source
• write a macro that does the work of the IF fields. This would take a lot more work than simply creating the IF fields and would be harder to use and maintain.