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

How to get all values ?

I use the following script to get all possible values  in vb macro

SET Field1 = Doc.Fields("CodeGroupe").GetPossibleValues

How could I get all values possible and exluded for a field ?

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Or maybe something like

SUB Test

Set  field = ActiveDocument.GetField("FieldName")

msgbox( field.GetCardinal )

for i = 1 to field.GetCardinal

  msgbox(ActiveDocument.Evaluate("=FieldValue('FieldName',"&i&")"))

next

END SUB

View solution in original post

6 Replies
marcus_sommer

I think the easiest way will be to create these list within a variable in the gui per:

vList:

= concat({1} distinct Total CodeGroupe, ',')

and query them within the macro:

SET Field1 = Doc.Variables("vList").GetContent.String

- Marcus

Anonymous
Not applicable
Author

vList:

= concat({1} distinct Total CodeGroupe, ',')

and query them within the macro:

SET Field1 = Doc.Variables("vList").GetContent.String

Anonymous
Not applicable
Author

how could I loop over each values in the list ?

swuehl
MVP
MVP

Or maybe something like

SUB Test

Set  field = ActiveDocument.GetField("FieldName")

msgbox( field.GetCardinal )

for i = 1 to field.GetCardinal

  msgbox(ActiveDocument.Evaluate("=FieldValue('FieldName',"&i&")"))

next

END SUB

marcus_sommer

You could create an array from this variable and loop through it, like:

...

arr = split(Field1, ",")

for i = 0 to ubound(arr) - 1

     xyz = arr(i)

     ....

next

....

- Marcus

yakir_manor
Contributor III
Contributor III

did a small qvw with a simple macro that works