Scrap the details of website

jayymehta

New Member
Joined
Jan 3, 2018
Messages
18
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.

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.
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

Forum statistics

Threads
1,223,910
Messages
6,175,318
Members
452,634
Latest member
cpostell

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top