Hi,
Would like to ask assistance on my code, please. I've tried a lot of ways of trying to pull the data from a table and i always encounter error when using the class, ID and ID only pulls the headers. I'm getting desperate. Sorry, this is a protected site so i can only give you sample names/sitesThank you in advance.
The information I need is the "Important" one below.
I tried below but nothing pulls up. Not sure it's the table number because nothing pulls up in Immediate window
i have tried others but this is the last one i've tried. Kindly help, please. Thank you!
Would like to ask assistance on my code, please. I've tried a lot of ways of trying to pull the data from a table and i always encounter error when using the class, ID and ID only pulls the headers. I'm getting desperate. Sorry, this is a protected site so i can only give you sample names/sitesThank you in advance.
The information I need is the "Important" one below.
Rich (BB code):
<div id="seareResultSection:>
<br>
<style?...</style>
<style type="text/css">...</style>
<div style="width:98%; margin: 0 auto;">...</div>
<div class="gridbox" style="width: 100%;">
<div class="k=widget k-grid k-reorderable" id="searchResultGrid" style="height: 612px; width: 98%; margin : 0px auto; touch-action: pan-y;" data-role="grid"> ==$0
<div class="k-grid-header" style="padding-right; 17px;">...</div> ==$0
<div class="k-grid-content" style="height: 551px;> ==$0
<table role="grid" data-role="selectable" class="k-selectable" style="touch-action: pan-y;">
<colgroup>...</colgroup>
<tbody role="rowgroup">
<tr data-uid="0bf44c93-9b27-4db7-b7b3-1ed34ev859c5" role="row" class aria-selected="false">...</tr> ==$0
<tr class="k-alt k-state-selected" data-uid="35ea93ce-88f9-4e54-ac82-606235c4b2e6" rolse="row" aria-selected="true"> ==$0
<td role="gridcell" class>
<span> GC Stuff </span>
</td>
<td role="gridcell">NORTHSTORE; North Store</td> ==$0
<td role="gridcell"> ==$0
<span class="ViewPersonData">UNASSIGNED </span>
</td>
<td role="gridcell">Fax</td> ==$0
<td role="gridcell">Important</td> == $0
I tried below but nothing pulls up. Not sure it's the table number because nothing pulls up in Immediate window
VBA Code:
Private Sub CommandButton3_Click()
'dimension (set aside memory for) our variables
Dim mySh As Worksheet
Set mySh = ThisWorkbook.Sheets("Search")
Dim IE As Object
Dim doc As HTMLDocument
Set IE = New InternetExplorerMedium
'Launch IE
IE.Visible = True
IE.Navigate "https://website"
Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop
Worksheets("Search").Range("B2").Select
Selection.Copy
IE.document.getElementById("SearchValue").Value = ActiveCell.Value
IE.document.getElementById("searchBtn").Click
Dim table As HTMLTable
Dim trCounter As Integer
Dim tdCounter As Integer
trCounter = 1
tdCounter = 1
For Each table In IE.document.getElementById("seareResultSection").getElementsByTagName("table")(2)
For Each tr In table.getElementsByTagName("tr")
For Each td In tr.getElementsByTagName("td")
mySh.Cells(trCounter, tdCounter).Value = td.innerText
tdCounter = tdCounter + 1
Next td
tdCounter = 1
trCounter = trCounter = 1
Next tr
Next
End Sub
i have tried others but this is the last one i've tried. Kindly help, please. Thank you!