Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Guys,
I have a table field named FullName.
How do I retrieve the value ( only 1 already selected value from the field) to a variable in a macro?
Something like:
Dim Name
Name = ActiveDocument.Field(FullName).GetContent().String
Thanks in advance,
Aldo.
I'm lazy, so usually, I'll make a variable that is equal to:
=GetFieldSelections(FullName) or =ONLY(FullName)
And then in my macro use:
Name = ActiveDocument.Variables(vName).GetContent.String
If you only have one selection, you can do it without the variable using:
set doc = ActiveDocument
set mySelections = doc.fields("Field").GetSelectedValues
mySelections.Item(0).text
If you have more than one selection, then you have to loop through the item array.
I'm lazy, so usually, I'll make a variable that is equal to:
=GetFieldSelections(FullName) or =ONLY(FullName)
And then in my macro use:
Name = ActiveDocument.Variables(vName).GetContent.String
If you only have one selection, you can do it without the variable using:
set doc = ActiveDocument
set mySelections = doc.fields("Field").GetSelectedValues
mySelections.Item(0).text
If you have more than one selection, then you have to loop through the item array.
Thanks man, I did it as you with the variable.
Aldo.