B
bz
This may be a duplicate post, if so could you repeat any answers? Thanks!
I have a series of repeating FormFields representing questions which are
identical except for the FormField name (e.g. location1, location2). Rather
than capture the answers via a hardcoded routine, I want to loop through the
fields, dynamically building the FormField name based on the loop value. For
example:
strLocation = "ActiveDocument.FormFields(""location" & Trim(str(i)) &
""").Result"
This produces an accurate value (i.e.,
ActiveDocument.FormFields("location1").Result, when the loop value is 1); but
I want to use it in an If statement in order to base action on the Result
value. To do this I need to be able to evaluate the value of the string
rather than just pick up the name. I can't find any functions to do this.
If I assign a FormField value to a string, then I can use the string in an
If statement, but this means more hardcoding: e.g.,
strLocation = ActiveDocument.FormFields("location1").Result
If strLocation = "Y" Then...
Thanks in advance for any help, or alternative approaches.
I have a series of repeating FormFields representing questions which are
identical except for the FormField name (e.g. location1, location2). Rather
than capture the answers via a hardcoded routine, I want to loop through the
fields, dynamically building the FormField name based on the loop value. For
example:
strLocation = "ActiveDocument.FormFields(""location" & Trim(str(i)) &
""").Result"
This produces an accurate value (i.e.,
ActiveDocument.FormFields("location1").Result, when the loop value is 1); but
I want to use it in an If statement in order to base action on the Result
value. To do this I need to be able to evaluate the value of the string
rather than just pick up the name. I can't find any functions to do this.
If I assign a FormField value to a string, then I can use the string in an
If statement, but this means more hardcoding: e.g.,
strLocation = ActiveDocument.FormFields("location1").Result
If strLocation = "Y" Then...
Thanks in advance for any help, or alternative approaches.