I have been trying to use VBA to make some work I have in Excel Easier, so far, it has been great.. But currently I have these 2 elements I have to grab out of a HTML document that I cant for the life of me figure out :
Firstly, here is my current code :
Enum READYSTATE
READYSTATE_UNINITIALIZED = 0
READYSTATE_LOADING = 1
READYSTATE_LOADED = 2
READYSTATE_INTERACTIVE = 3
READYSTATE_COMPLETE = 4
End Enum
Public Sub GetData()
Site = InputBox("Enter Website Link ", "Enter Product Link")
Dim ie As InternetExplorer
Dim html As HTMLDocument
Set ie = New InternetExplorer
ie.Visible = False
ie.navigate Site
Do While ie.READYSTATE <> READYSTATE_COMPLETE
Application.StatusBar = "Trying to go to Product Page..."
DoEvents
Loop
Set html = ie.document
Set ie = Nothing
Application.StatusBar = ""
Dim Title As String
Dim Description As String
Dim Vendor As String
Dim Image As String
Dim PType As String
Vendor = ???
Image = ???
Title = html.getElementsByClassName("name")(0).innerText
Description = html.getElementsByClassName("specs block")(0).outerHTML
PType = html.getElementsByClassName("kind")(0).innerText
Cells(ActiveCell.Row, 2) = Title
Cells(ActiveCell.Row, 3) = Description
Cells(ActiveCell.Row, 4) = Vendor
Cells(ActiveCell.Row, 5) = PType
End Sub
What I'm looking for is that Vendor variable ( called "brand" below ) as well as the Image link, here is the snippet of HTML that displays the values :
<meta itemprop="brand" content="Intel" />
<meta itemprop="image" content="http://ecx.images-amazon.com/images/I/510BosCAMcL.jpg" />
The line's "content" is what im looking for.
Any help would be appreciated, thanks!
( PS. the HTML comes from this link : https://pcpartpicker.com/product/W67wrH/intel-cpu-bx80646g1820 )