Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a requirement where I have
1. to get the Selected Field Value in a variable
2. Add a text to the variable
3. Store this content into a new variable
4. Clear all the field values selected.
Sub Var_Test
Set sel_val = ActiveDocument.Fields("Country").GetSelectedValues
v= sel_val.Item(0).Text &", All Countries"
msgbox(v)
ActiveDocument.Variables("vTargetSpecies").SetContent v, true
ActiveDocument.Fields("Country").Clear
End Sub
The Macro is failing when being called. Can you please suggest me on this.
Thanks,
Venu
Hi,
Your macro works. Make sure value is selected in the Listbox. The variable must be defined as well before macro is executed.
BR,
Kuba
Might be problem in your script. Try this
v= sel_val.Item(0).Text & "All Countries"
Hey,
I tested his macro and it works just fine. It only fails in two situations:
1) Variable is not defined
2) No Country is selected.
BR,
Kuba