cancel
Showing results for 
Search instead for 
Did you mean: 

Using the variable number in a loop

Former Member
0 Kudos

Hi guys,


Writing a simple vbs from Excel to perform SAP tasks but having a problem when I want to use the loop variable.

If I'm not in a loop then this works perfectly. Data is stored in variable Enumber and I can work with it.

Enumber = session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT/ctxtRC29P-IDNRK[2,1]").Text

The problem I'm having is when I want to use a loop to check all the rows in the square brackets. For example, when I want to check 10 rows I'd do this ....

For r = 1 to 10

But what format do I need to use to be able to use the r variable for the row number in the square bracket?

I've tried ..

....[2,) & r & (]") but that doesn't work and tried a few other variants too.

Thanks,

Mark

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

It's ok, I found the answer myself through looking on this forum.

Syntax should be ....

[2," & r & "]").Text

🙂

Answers (0)