Pak Mariman
New Member
- Joined
- Jan 15, 2017
- Messages
- 21
I am trying to extract an element from a website and stick it into a cell on my spreadsheet:
(in this I have dimmed the variable IE as New InternetExplorer). The navigate bit works.
The website bit that I am after looks like:
<span id="apples">here is the text I am after<br>and this text too<br></span>
I get a 438 error.
How and why, and how to change my code? I cannot use the following code:
because I am probing several similar URLs and the number of the "span" tag is not consistent.
Thanks!
VBA Code:
Worksheets("Sheet1").Cells(1, 1).Value = IE.document.getElementsByClassName("apples").innerText
(in this I have dimmed the variable IE as New InternetExplorer). The navigate bit works.
The website bit that I am after looks like:
<span id="apples">here is the text I am after<br>and this text too<br></span>
I get a 438 error.
How and why, and how to change my code? I cannot use the following code:
VBA Code:
Worksheets("Sheet1").Cells(1, 1).Value = IE.document.getElementsByTagName("span")(counter).innerText
because I am probing several similar URLs and the number of the "span" tag is not consistent.
Thanks!