Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am trying to assign the MultiBox selection of a field to a variable (the user selected field value in the list should be assigned to a varaible for later calculations).
After seraching around, I created 2 empty varaibles in the load script as well as the following macro (sheet object trigger)
Sub Set_Product_Value
Set ProductTemp = ActiveDocument.Variables("Product_Temp")
Set ProductValue = ActiveDocument.Variables("Product_Value")
Set ProductTemp = ActiveDocument.Fields("Product").GetSelectedValues
ProductValue.SetContent ProductTemp ,true
End Sub
However I get the following error: Type mismatch: 'ProductValue.SetContent'
I am trying to have the value assigned to the variable 'Product_Value' in the document.
What is wrong ?
Thanks
Simply you can use as
ProductTemp = ActiveDocument.Evaluate("GetFieldSelections(Product)")
Hi
GetSelectedValues is a list (can say as array) of values. you cannot assign it to a QV variable.
You need to use
activedocument.Evaluate("GetFieldSelections(Product, ',', 99)")
Hope it helps
Thank you for the quick answer.
I updated the concerned line with:
Set ProductTemp = ActiveDocument.Evaluate([string:"GetFieldSelections(Product)"])
Only one value is possible, so I omitted the extra varaibles in the GetFieldSelections function.
As you can see I also added [string: "-"], as I get an error message.
The items in the 'Product' list are effectively multi-word.
How would I assign this acorrectly in the macro ?
Simply you can use as
ProductTemp = ActiveDocument.Evaluate("GetFieldSelections(Product)")