Many developers have a need to evaluate multiple "Like" fields within a single If statement or multiple If statements and find themselves duplicating the same If statement over and over again for each of the fields. This leaves them thinking, "I wish I could loop through all of these fields using a For loop."
For example, a 20-row table with a field in each row like this:
First row: Field1
Second row: Field2
Third row: Field3
and so on....
They are forced to script as follows:
If Field1 .... Then
If Field2 .... Then
and so on .... This can result in quite lengthy scripts.
Well now you can loop through these fields. Here's how:
Code: ...set value of doc For i = 1 To 20 itemname = "Field"&Cstr(i) itemvalue = doc.GetItemValue(itemname) If itemvalue .... Then EndIf Next