New Member
February 16, 2019
Hello Friends,
I am trying to automate using Excel Macro. Here is the breakup of objective-
a. Launch web page - trweb.co.clark.nv.us
b. Populate web search form with data in column A
c. Click the submit button
d. Store required portion (CellData) of table data in column G
e. Loop to automate.
HERE IS MY CODE. I AM STUCK WITH STEP d. The required output data has class=CellData and has multiple instances of this class. I tried capturing by tr tag as well but to no avail. Looping hasn't been done in code yet as I haven't got positive response with Step d. PLEASE HELP GUYS....
Sub PullSitus()
Dim IE As New InternetExplorer
Dim result As MSHTML.HTMLDocument
Dim doc As HTMLDocument
IE.Visible = True
IE.navigate "http://trweb.co.clark.nv.us/"
Do While IE.readyState <> READYSTATE_COMPLETE
Loop
IE.document.forms("Search").elements("Valid_ID").Value = ThisWorkbook.Sheets("Sheet1").Range("A" & 2).Value
'change value propety of "Valid_ID" element of "Search" form with data from cell $A2 of this workbook
IE.document.forms("Search").elements("Submit").Click
'Click on "Submit" element of "Search" form
Do While IE.readyState <> READYSTATE_COMPLETE
Loop
Set doc = IE.document
Set result = doc.getElementsByClassName("CellData").Item(4).innerText
ThisWorkbook.Sheets("Sheet1").Range("G" & 2) = result.Value
End Sub
October 5, 2010
Hi Peter,
Can you please supply the workbook with the data to be used in Step b, otherwise the form submission doesn't work.
Please explain what it is you are trying to do and what data you are trying to get from the site, it's hard to work out just by reading code.
Regards
Phil
1 Guest(s)