If you have a field called "KeywordList" that has the following values: "Test1 | 1" "Test2 | 2" "Test3 | 3" "Test4 | 4" "Test5 | 5" That you use to populate another keyword field Called "SelectFromList" After a person selects the values: Test1 Test5 the values 1,5 are stored in "SelectFromList." For whatever reason, you need to know the Alias. If the list is very large, this becomes very difficult. The GetReverseAlias function tells you what those Alias are.
How to call Call doc.ReplaceItemValue( "SelectedFromListAlias" , GetReverseAlias( doc.GetItemValue( "KeywordList" ), doc.GetItemValue( "SelectFromList" )) ) Function GetReverseAlias( varAllList As Variant, varKeywords As Variant ) As Variant Dim Alllist List As String Dim strAlias As String Dim strValue As String Dim strReturn() As String Dim intCount As Integer intCount = 0 Redim strReturn(intCount) strReturn(intCount) = "" Forall strOneValue In varAllList strAlias = Trim( LeftOfString( Cstr( strOneValue ), "|" ) ) strValue = Trim( RightOfString( Cstr( strOneValue ), "|" ) ) If Not ( Iselement( AllList( strValue ) ) ) Then Alllist( strValue ) = strAlias End If End Forall Forall strOneKeyword In VarKeywords Redim Preserve strReturn(intCount) If Iselement( AllList( strOneKeyword ) ) Then strReturn(intCount) = Alllist( strOneKeyword ) Else strReturn(intCount) = "" End If intCount = intCount + 1 End Forall GetReverseAlias = strReturn End Function Function RightOfstring ( strSource As String, strSearch As String ) As String Dim intPos As Integer Dim intLength As Integer Dim intStart As Integer intPos = Instr ( strSource, strSearch ) intLength = Len( strSource ) intStart = intLength - ( intPos + Len( strSearch ) - 1 ) RightOfstring = Right ( strSource, intStart ) End Function Function LeftOfstring ( strSource As String, strSearch As String ) As String Dim intPos As Integer intPos = Instr ( strSource, strSearch ) If intPos > 0 Then intPos = intPos -1 LeftOfstring = Left ( strsource, intPos ) End Function