Hi, I'm trying to extract some data from www.ebay.in website, wherein, when the category is selected, the name, price and URL of all the products on first page extracts in an excel sheet. I tried doing that, but getting a Debug error on setting HTML Document.
I'm stuck from here now... If possible, kindly throw some light in it.
Thanks in advance.
Code:
[/FONT][/COLOR]Sub ebayprj()Dim ie As InternetExplorer
Dim html As HTMLDocument
Set ie = New InternetExplorer
ie.Visible = True
ie.navigate "http://www.ebay.in"
Do While ie.readyState <> READYSTATE_COMPLETE
Application.StatusBar = "Trying to go to StackOverflow ..."
DoEvents
Loop
Set html = ie.Document
Set ie = Nothing
Cells.Clear
With Workbooks("Trials.xlsm").Worksheets("Sheet1")
Range("A2").Value = "Product Name"
Range("A2").Font.Italic = True
Range("A2").Interior.ColorIndex = 44
Range("B2").Value = "Price"
Range("B2").Font.Italic = True
Range("B2").Interior.ColorIndex = 44
Range("C2").Value = "URLs"
Range("C2").Font.Italic = True
Range("C2").Interior.ColorIndex = 44
End With
Dim ebaycateg As IHTMLElement
Dim ebaycategopt As IHTMLElementCollection
Set ebaycateg = html.getElementByClassName("gh-cat")
Set ebaycategopt = ebaycateg.Children
For Each ebaycategopt In ebaycateg
Selection.Index = 0
Next
Dim resultitems As IHTMLElement
Dim pname As IHTMLElement
Set resultitems = html.getElementById("Results")
Set pname = html.getElementsByClassName("sresult lvresult clearfix li shic")
End Sub
[COLOR=#4D5763][FONT=arial]
I'm stuck from here now... If possible, kindly throw some light in it.
Thanks in advance.