Data extraction from HTML

Sharid

Well-known Member
Joined
Apr 22, 2007
Messages
1,047
Office Version
  1. 2016
Platform
  1. Windows
I am trying to pull the following data from this html text, but can not seem to work it out. I have the bulk of my code and was trying to change some parts that deal with the extraction but can not work this out. Please could someone take a look

1602167785324.png


Code that should pull off the data
VBA Code:
           For Each li In HTMLdoc.getElementsByTagName("li")
                If li.getAttribute("class") = "a-link-normal" Then 
                Set link = li.getElementsByTagName("a")(0)
                .Cells(i, 1).Value = link.getAttribute("href")
                i = i + 1
            End If
    Next li

Another variation of the code
VBA Code:
      For Each div In HTMLdoc.getElementsByClassName("a-row a-spacing-none s-see-all-c3-refinement s-see-all-refinement-list")
                If div.getAttribute("class") = "s-see-all-indexbar-column" Then 
                Set link = div.getElementsByTagName("a")(0)
                .Cells(i, 1).Value = link.getAttribute("href")
                i = i + 1
            End If
    Next div

As always thanks in advance
 

Some videos you may like

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Sharid

Well-known Member
Joined
Apr 22, 2007
Messages
1,047
Office Version
  1. 2016
Platform
  1. Windows
For info only,

Also posted here
 

Watch MrExcel Video

Forum statistics

Threads
1,127,572
Messages
5,625,584
Members
416,119
Latest member
JCLLE

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
Top