here's some code i'm trying to run...
all variables are created prior the for loop runs, except the variables, na1, na2, na3,... which should be created on the fly during the for loop, see further down...
"undsc" is just a String Variable holding a " " to create a space between two entries...
Label9.text is just for visual reference of the for loop current state...
- Code: Select all
For 1 to 999
Label9.text = for.index
// prepare for cell calc, cell1 FirstName and cell2 LastName
WDTextboxAppendTextOnly,991,b
WDTextboxAppend,991,for.index
VGetTextboxText,cell1,991
WDTextboxAppendTextOnly,992,c
WDTextboxAppend,992,for.index
VGetTextboxText,cell2,992
VGetExcelCellValue,npf1,C:\coolux\WD_Projects\excel test\TestWD.xlsx,tab1,cell1
VGetExcelCellValue,npl1,C:\coolux\WD_Projects\excel test\TestWD.xlsx,tab1,cell2
WDTextboxAppend,1,npf1
WDTextboxappend,1,undsc
WDTextboxAppend,1,npl1
VGetTextboxText,fullname,1
it works fine, pulls the values from the excel cells and stores it combined in variable "fullname"
i use the textboxes to create the "correct" values for my variable to pull the data from the correct excel cell.
because it's a for loop, it should work for up to 999 entries,
each entry (finally) of the for loop shall create a new variable called na1, na2, na3,... up to na999
so, continueing from the last line of code above,
in the same for loop
- Code: Select all
// prepare for final string variable
WDTextboxAppendTextOnly,993,na
WDTextboxAppend,993,for.index
VGetTextboxText,namestr,993
WDWait,0.2
VString,namestr,fullname
//namestr = fullname
VValue,namestr,fullname
//VValue,na1,fullname
WDWait,0.2
WDTextboxClear,1
WDTextboxClear,991
WDTextboxClear,992
WDTextboxClear,993
Next
"namestr" should create, increasing with the for loop, the variables na1, na2,...
in each cycle of the loop, the current na... variable should get the value of "fullname", which represents the current data pulled from the excel cell.
i'm sure it's a basic thing i'm missing here, still new to programming...
all the best,
Roman