Skip to Content
avatar image
Former Member

Using the variable number in a loop

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.



Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Jan 23, 2015 at 03:58 PM

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

    Syntax should be ....

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


    Add comment
    10|10000 characters needed characters exceeded