score:0

the function getelementsbytagname() requires a tag name only as parameter: e.g. getelementsbytagname("div")

try getelementsbyclassname() instead:

getprice = trim(doc.getelementsbyclassname("price").item.innertext)

score:0

there were a few issues with the above code.

issue 1

getprice = trim(doc.getelementsbytagname("div class="price" itemprop="price"").innertext)

this: div class="price" itemprop="price" isn't a tagname. tagnames are things like input, img, anchors, etc. however, we can see the class attribute for the price element you are interested in. we can change how we select this element by doing:

getprice = trim(doc.getelementsbyclassname("price")(0).innertext)

you may notice (0) at the end of the element selection. this is to indicate which element is being selected of the price classname collection. getelementsbyclassname returns multiple elements, the first element being 0.

issue 2

worksheets("sheet1").range(c1).value = getprice

i don't c1 referenced anywhere. one way to reference a specific cell, is to use a string to represent the range. from your code this becomes:

worksheets("sheet1").range("c1").value = getprice


Related Query

More Query from same tag