Checkbox im IE in einer bestimmten Tabellenzeile anklicken

  • Excel

    Checkbox im IE in einer bestimmten Tabellenzeile anklicken

    Moin,

    ich versuche gerade aus einer HTML Tabelle bestimmte Zeilen herauszufiltern um in der gefunden Reihe dann eine checkbox zu aktivieren.

    An dem aktivieren der Checkbox scheitere ich nun :(

    Hier mal ein Auszug aus einer Beispieltabelle:

    HTML-Quellcode

    1. <table width="100%" cellspacing="0" cellpadding="0" border="0" class="treeContentLayout"><tbody>
    2. <tr class="treeHeadingRow"><th nowrap="true" class="treeHeadingCell">&nbsp;</th><th nowrap="true" class="treeHeadingCell" colspan="5">Bengr</th><th nowrap="true" class="treeHeadingCell">Siat</th><th nowrap="true" class="treeHeadingCell">Atw</th><th nowrap="true" class="treeHeadingCell">MSN</th><th nowrap="true" class="treeHeadingCell">Name</th><th nowrap="true" class="treeHeadingCell">Rechner</th><th nowrap="true" class="treeHeadingCell">Gdat</th><th nowrap="true" class="treeHeadingCell">Stodat</th></tr>
    3. <tr class="treeBaseRow" id="BSLEG_TREE_29289"><td width="1" height="22"><input type="hidden" value="" /><input type="checkbox" name="selectResults" value="29289" onClick="toggle(this, '29289');" /></td><td width="16" nowrap="true" height="22"><img height="22" border="0" src="images/tree/tree_linemiddlenode.gif" /></td><td><img border="0" src="images/tree/tree_domain.gif" /> </td><td nowrap="true" colspan="3">ALISTE </td><td nowrap="true">BEARBEIT</td><td nowrap="true">10160*</td><td nowrap="true"> </td><td nowrap="true"> </td><td nowrap="true">FF</td><td nowrap="true">04.09.2012</td><td nowrap="true">&nbsp;</td></tr>
    4. <tr class="treeBaseRow" id="BSLEG_TREE_29290"><td width="1" height="22"><input type="hidden" value="" /><input type="checkbox" name="selectResults" value="29290" onClick="toggle(this, '29290');" /></td><td width="16" nowrap="true" height="22"><img height="22" border="0" src="images/tree/tree_linemiddlenode.gif" /></td><td><img border="0" src="images/tree/tree_domain.gif" /> </td><td nowrap="true" colspan="3">ALISTE </td><td nowrap="true">BEARBEIT</td><td nowrap="true">1016000*</td><td nowrap="true"> </td><td nowrap="true"> </td><td nowrap="true">VH</td><td nowrap="true">27.12.2006</td><td nowrap="true">&nbsp;</td></tr>
    5. <tr class="treeBaseRow" id="BSLEG_TREE_29291"><td width="1" height="22"><input type="hidden" value="" /><input type="checkbox" name="selectResults" value="29291" onClick="toggle(this, '29291');" /></td><td width="16" nowrap="true" height="22"><img height="22" border="0" src="images/tree/tree_linemiddlenode.gif" /></td><td><img border="0" src="images/tree/tree_domain.gif" /> </td><td nowrap="true" colspan="3">ALT </td><td nowrap="true">ALLGEM</td><td nowrap="true">ABFRAGE_PARTNER_RES</td><td nowrap="true"> </td><td nowrap="true"> </td><td nowrap="true">VS</td><td nowrap="true">11.02.2008</td><td nowrap="true">&nbsp;</td></tr>
    6. <tr class="treeBaseRow" id="BSLEG_TREE_29292"><td width="1" height="22"><input type="hidden" value="" /><input type="checkbox" name="selectResults" value="29292" onClick="toggle(this, '29292');" /></td><td width="16" nowrap="true" height="22"><img height="22" border="0" src="images/tree/tree_linemiddlenode.gif" /></td><td><img border="0" src="images/tree/tree_domain.gif" /> </td><td nowrap="true" colspan="3">ALTEXTRA </td><td nowrap="true">BNRC</td><td nowrap="true">3026700</td><td nowrap="true"> </td><td nowrap="true"> </td><td nowrap="true">VH</td><td nowrap="true">14.03.2018</td><td nowrap="true">&nbsp;</td></tr>
    7. </tbody>
    8. </table>


    Hier der VBA Code womit ich zumindest schon mal die Zeile finde die ALTEXTRA BNRC und 3026700 enthält und nun möchte ich vorne die Checkbox clicken, aber ich weiß nicht wie ? ?(

    Visual Basic-Quellcode

    1. Dim i, bis, zaehler, id, d, loesch As Integer
    2. Dim rng As Range, rngC As Range, IntC, bi As Integer
    3. Dim fbensl As String
    4. Dim BG()
    5. 'dimension (declare or set aside memory for) our variables
    6. Dim objIE As InternetExplorer 'special object variable representing the IE browser
    7. Dim aEle As HTMLLinkElement 'special object variable for an <a> (link) element
    8. Dim y As Integer 'integer variable we'll use as a counter
    9. Dim result As String 'string variable that will hold our result link
    10. 'initiating a new instance of Internet Explorer and asigning it to objIE
    11. 'Set objIE = New InternetExplorer
    12. Set objIE = CreateObject("Internetexplorer.Application")
    13. 'make IE browser visible (False would allow IE to run in the background)
    14. objIE.Visible = True
    15. 'navigate IE to this web page (a pretty neat search engine really)
    16. objIE.navigate "https://testseite.intern.de"
    17. Dim i1 As Long
    18. Dim s1, s2, s3, s4 As String
    19. For i1 = 0 To objIE.Document.all.tags("TD").Length - 1
    20. s2 = objIE.Document.all.tags("TD").Item(i1).innerText
    21. s3 = objIE.Document.all.tags("TD").Item(i1 + 1).innerText
    22. s4 = objIE.Document.all.tags("TD").Item(i1 + 2).innerText
    23. If s2 = "ALTEXTRA " And s3 = "BNRC" And s4 = "3026700" Then
    24. MsgBox objIE.Document.all.tags("TD").Item(i1 - 3).innerText & " " & objIE.Document.all.tags("TD").Item(i1 + 1).innerText & " " & objIE.Document.all.tags("TD").Item(i1 + 2).innerText
    25. Exit For
    26. End If
    27. Next i1


    LG

    vbbaby