Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Regarding Variables

Hi All,

I want to put the selected value of listbox into a variable. Can i do that?

Waiting for your reply

Thanks in advance

1 Solution

Accepted Solutions
Not applicable
Author

Set the variable value =CONCAT(FieldName, ';') and you will receive all selected records in one line separated by ;

View solution in original post

7 Replies
Not applicable
Author

Hi,

if you just select one single value you can use "=FieldName" as variablevalue. But i think, you select more then one, don´t you?

Kind regards.

Not applicable
Author

Depends what you need to do with your variable. Showing selections in a text object is as simple as

=GetFieldSelections(field)

Not applicable
Author

Set the variable value =CONCAT(FieldName, ';') and you will receive all selected records in one line separated by ;

Not applicable
Author

hi adamvaughan,

Using =GetFieldSelections(field) will show something like "20 of 3032" for large selections.

Not applicable
Author


luciaN wrote:
Set the variable value =CONCAT(FieldName, ';') and you will receive all selected records in one line separated by ;<div></div>


That´s nice. I haven´t known this opinion before.

Not applicable
Author

Hi All,

Thanks for your quick replies. I have one more doubt.

How can i implement the =GetFieldSelections(field) within a macro??

Thanks,

Rajesh

Not applicable
Author

Its true that you do get "x of y" however I dont know how many things are being selected 😉

What we need here is the requirement - its not clear what is being selected nor what to do with those values.

If you search this forum for "loop" you should find a working example similar to this:

set myListBox= ActiveDocument.GetSheetObject("LB01")
myValues=myListbox.GetPossibleValues

for mycounter = lbound(myValues) to ubound(myValues)
ActiveDocument.Fields("TheFieldUsedinLB01").Select myValues(mycounter )