Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub SearchBot()
- Dim objIE As InternetExplorer 'special object variable representing the IE browser
- Dim y As Integer 'integer variable we'll use as a counter
- Set objIE = New InternetExplorer
- 'Set objIE = CreateObject("InternetExplorer.Application")
- objIE.Visible = True
- objIE.navigate [Sales_Link]
- Do While objIE.Busy = True Or objIE.readyState <> 4: DoEvents: Loop
- On Error GoTo eeherror
- 'Thats the part where I straggle for picking dropdown object
- Set Post = objIE.document.getElementByAttributeName("cboSaleDate")
- For Each elem In Post.getElementsByName("option")
- If Len(elem.Value) > 4 Then
- elem.Selected = True
- Do While objIE.Busy = True Or objIE.readyState <> 4: DoEvents: Loop
- Set hBody = objIE.document.getElementsByTagName("tbody")
- Z = Application.WorksheetFunction.CountA(Sheets("Mediator").Range("A:A")) + 1
- For Each bb In hBody
- Set hTR = bb.getElementsByTagName("tr")
- For Each tr In hTR
- Set hTD = tr.getElementsByTagName("td")
- y = 1 ' Resets back to column A
- For Each td In hTD
- Cells(Z, y) = td.innerText
- y = y + 1
- Next td
- DoEvents
- Z = Z + 1
- Next tr
- Exit For
- Next bb
- End If
- Next elem
- objIE.Quit
- eeherror:
- objIE.Quit
- Exit Sub
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement