Hello, I'm trying to make a search string to store into a variable for later use via a macro. I already have an action on a button that is doing this, but I'm trying to make a macro to do this instead (the reason is that I want a number of variables to be set according to which button was pushed, and I think it will be easier to maintain in a macro rather than in 10+ Set Variable actions). Currently my Select in Field action is doing this:
I'm trying to get a macro to form the same string value (i.e. ("A"|"B")). Currently I have this in my macro:
Set fieldSelections = ActiveDocument.Fields("ENTITY_NAME", "state1").GetSelectedValues()
Set concatString = "(""" & Join(fieldSelections, """|""") & """)"
but I am receiving an error on the second line. From what I've read, the Join function in VBScript is meant to take an array and delimiter and return a string value (VBScript Join Function). However, the GetSelectedValues() method returns an object of the IArrayOfFieldValue class, which I assume works like an array. Is there any way that I can concatenate the values returned by GetSelectedValues()?