Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GetRowWithCellText does not work if the header has a colspan
#7
Solved: 11 Years, 3 Months, 3 Weeks ago
Thanks "ConstantChange" for posting this thread and for your proposed solution.

And thanks "Anshoo Arora" for your proposed solution, I tried it but it suffered also from the same problem that the "colTotal" always reads the first row columns. and the line "sData = ColInfoTable.GetCellData(rowStart,colStart)" needed small correction to be "sData = oTable.GetCellData(rowStart,colStart)". I've made small modifications to your function correcting the errors and adding 2 new parameters; the table as an input object and the table columns to make it more generic.

Code:
Public function getTargetRow(oTable, sText, colTotal)
    rowTotal = oTable.GetROProperty("rows")
    For rowStart = 1 to rowTotal
        For colStart = 1 to colTotal
            sData = oTable.GetCellData(rowStart,colStart)
            If sData = sText Then
                getTargetRow = rowStart
                Exit Function
            End If
        Next
    Next
End Function

To call this function:
Code:
Set myTableObject = Browser("myBrowser").Page(myPage").WebTable("myTable")
msgbox getTargetRow(myTableObject, "myText", 2)
Reply


Messages In This Thread
RE: GetRowWithCellText does not work if the header has a colspan - by Mahmoud.Karam - 05-08-2012, 04:19 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Set the column header in the excelsheet before importing it to local datasheet nageshpv 2 3,473 08-04-2008, 04:05 PM
Last Post: nageshpv

Forum Jump:


Users browsing this thread: 3 Guest(s)