0

I've looked around and I'm not sure this question has been asked before. I think I'm onto the beginning of a solution but here is my issue. I have an HTML table on a web page that has an input element built into it and I need to access it through VBA. Here is the relevant snippet of the HTML:

<td class="tbl1"><input size="11" type="text" maxlength="9" name="txtCusipNo" value=''><a href="javascript:;" onclick="window.open('/SecFinderII1/SIM_SeekSearch.jsp?clientobjectreference=frmSearchEntry.txtCusipNo&formname=frmSearchEntry&textboxname=txtCusipNo','SecurityFinder','resizable=yes,scrollbars=yes,status=no');"><img src="/Settlement/static/images/pbs/lookup.gif" border="0" alt="Open Security Finder" align="absmiddle"></a>&nbsp;<img name="imgCusipNo" src="/Settlement/static/images/pbs/req.gif" border="0" align="top"></td>

I can find this cell easily enough using the following code:

Set Cells = HTMLDoc.getElementsByTagName("td")
For Each Cell In Cells
    If Cell.className = "tbl1" And Cell.something = something Then
        'This is the cell
    End If
Next Cell

There are only 5 cells on the page, so no big deal. What I still need to do is to figure out how to use the input element. I guess through get child or something? Can't seem to find any leads on that...

1 Answer 1

1

Try InvokeMember:

Set Cells = HTMLDoc.getElementsByTagName("td")
For Each Cell In Cells
    If Cell.className = "tbl1" And Cell.something = something Then
        Cell.InvokeMember("click")
    End If
Next Cell
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.