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:
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 ?
LG
vbbaby
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
- <table width="100%" cellspacing="0" cellpadding="0" border="0" class="treeContentLayout"><tbody>
- <tr class="treeHeadingRow"><th nowrap="true" class="treeHeadingCell"> </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>
- <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"> </td></tr>
- <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"> </td></tr>
- <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"> </td></tr>
- <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"> </td></tr>
- </tbody>
- </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
- Dim i, bis, zaehler, id, d, loesch As Integer
- Dim rng As Range, rngC As Range, IntC, bi As Integer
- Dim fbensl As String
- Dim BG()
- 'dimension (declare or set aside memory for) our variables
- Dim objIE As InternetExplorer 'special object variable representing the IE browser
- Dim aEle As HTMLLinkElement 'special object variable for an <a> (link) element
- Dim y As Integer 'integer variable we'll use as a counter
- Dim result As String 'string variable that will hold our result link
- 'initiating a new instance of Internet Explorer and asigning it to objIE
- 'Set objIE = New InternetExplorer
- Set objIE = CreateObject("Internetexplorer.Application")
- 'make IE browser visible (False would allow IE to run in the background)
- objIE.Visible = True
- 'navigate IE to this web page (a pretty neat search engine really)
- objIE.navigate "https://testseite.intern.de"
- Dim i1 As Long
- Dim s1, s2, s3, s4 As String
- For i1 = 0 To objIE.Document.all.tags("TD").Length - 1
- s2 = objIE.Document.all.tags("TD").Item(i1).innerText
- s3 = objIE.Document.all.tags("TD").Item(i1 + 1).innerText
- s4 = objIE.Document.all.tags("TD").Item(i1 + 2).innerText
- If s2 = "ALTEXTRA " And s3 = "BNRC" And s4 = "3026700" Then
- 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
- Exit For
- End If
- Next i1
LG
vbbaby