Macro to loop through and enumerate all field selections - wanted to share works under Ajax
Below is a macro that I think is pretty cool. It even works under Ajax.
The only limitation is the field size in the macro. I have successfully put over 1.5 million characters in the field but somewhere above that it blows up.
This macro reads a variable, writes to the variable and loops through all fields to enumerate their selections into an email. This is useful because without this you would end up with County: 30 of 50,000 instead of listing all counties.
Assumptions:
Variable called vMessageBody
1 or more field selections
function sendSelectionsBySMTP
fieldName="$Field"
myText=" "
Set val=ActiveDocument.Fields(fieldName).GetPossibleValues(20000)
For i=0 to val.Count-1
set valsCount=ActiveDocument.Fields(val.item(i).Text).GetSelectedValues
Set val2=ActiveDocument.Fields(val.Item(i).Text).GetSelectedValues