Hi everyone,
For a couple of days Im trying to scrap specific data from a website but when I try to go through nested tags I get an error message. The table I want to get data from is at the bottom of this page (Ajax vs AZ - Netherlands Eredivisie Head to Head (H2H) Statistics and Match Preview - SoccerPunter.com) I want to get the number of matches played by Ajax which is 34. That number I want to retrieve.
In order to do this I'd have to use getElementsByTagName and getElementsByID then when I find the table I need a loop to get the right team statistics.
First I find the table location in which the value is stored.
Here my error is (object doesnt support this property or method)
For Each elem In doc
(loop trough the web table to get number 34)
I think it has something to do with the () because when I use a simular like code without them I dont get errors.
Beneath is the HTML code for the page that I am searching on.
The value I want to retreive is all the way at the bottom (34)
What I basically want is actually pretty straight forward, i want to be able to retrieve a nested value from a website in VBA. I'm struggling with this for a while now so any help is more than welcome.
Thanks in advance
For a couple of days Im trying to scrap specific data from a website but when I try to go through nested tags I get an error message. The table I want to get data from is at the bottom of this page (Ajax vs AZ - Netherlands Eredivisie Head to Head (H2H) Statistics and Match Preview - SoccerPunter.com) I want to get the number of matches played by Ajax which is 34. That number I want to retrieve.
In order to do this I'd have to use getElementsByTagName and getElementsByID then when I find the table I need a loop to get the right team statistics.
First I find the table location in which the value is stored.
Here my error is (object doesnt support this property or method)
PHP:
Set doc = ie.documents.getElementById("h2hFactSheet").getElementsByTagName("tbody")(1).getElementsByTagName("tr")(20).getElementsByTagName("td")
For Each elem In doc
(loop trough the web table to get number 34)
I think it has something to do with the () because when I use a simular like code without them I dont get errors.
Beneath is the HTML code for the page that I am searching on.
The value I want to retreive is all the way at the bottom (34)
PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<head></head>
<body data-twttr-rendered="true">
******** id="twttrHubFrameSecure" frameborder="0" allowtransparency="true" scrolling="no" tabindex="0" name="twttrHubFrameSecure" style="position: absolute; top: -9999em; width: 10px; height: 10px;" src="https://platform.twitter.com/widgets/hub.fe4e93d64f1afc988e99833088f71057.html">*********>
******** id="twttrHubFrame" frameborder="0" allowtransparency="true" scrolling="no" tabindex="0" name="twttrHubFrame" style="position: absolute; top: -9999em; width: 10px; height: 10px;" src="http://platform.twitter.com/widgets/hub.fe4e93d64f1afc988e99833088f71057.html">*********>
******** type="text/javascript">*********>
<div id="wrapper">
<div id="wp_inn">
<a id="soccer-picks" name="soccer-picks"></a>
<div id="header"></div>
<div id="content_box">
<table id="content" cellspacing="0" cellpadding="0" border="0">
<!--
DWLayoutTable
-->
<tbody>
<tr>
<td id="center_column" valign="top">
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<td>
<table width="640" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
<tbody>
<tr></tr>
<tr></tr>
<tr>
<td>
<p></p>
<p></p>
<div id="h2hSelect"></div>
********>*********>
<p></p>
<p></p>
<p></p>
<div class="oldSeasonH2hWarning"></div>
<div class="oldSeasonH2hWarningPopup"></div>
******** src="/script/jquery.bpopup.min.js?ver=1392848372">*********>
******** src="/script/oldSeasonH2hWarning.js?ver=1392929478">*********>
<table id="h2hHead" width="100%"></table>
<p></p>
<!--
STATS TABLE
-->
<table id="h2hSimpleStats"></table>
<!--
END STATS TABLE
-->
<p></p>
<h2></h2>
<p></p>
<p></p>
<div id="h2hPie" style="position: relative;"></div>
********>*********>
******** type="text/javascript" src="https://www.google.com/uds/?file=visualization&v=1&packages=corechart">*********>
<link rel="stylesheet" type="text/css" href="https://www.google.com/uds/api/visualization/1.0/ff67c3772da186a412ae3231c32409e9/ui+nl.css"></link>
******** type="text/javascript" src="https://www.google.com/uds/api/visualization/1.0/ff67c3772da…2ae3231c32409e9/format+nl,default+nl,ui+nl,corechart+nl.I.js">*********>
<table id="h2hSum" class="competitionRanking tablesorter"></table>
<h2></h2>
<p></p>
<p></p>
<table id="h2hMatches" class="competitionRanking tablesorter"></table>
********>*********>
<h2></h2>
<p></p>
<div id="perfChart" style="position: relative;"></div>
******** type="text/javascript">*********>
<p></p>
<h2></h2>
<table id="h2hFactSheet" class="competitionRanking tablesorter"></table>
********>*********>
<div class="highestOddsWidget"></div>
<p></p>
<div id="beacon_cd41357a33" style="position: absolute; left: 0px; top: 0px; visibility: hidden;"></div>
<noscript></noscript>
<p></p>
<p></p>
<p></p>
<h2></h2>
<p></p>
<p></p>
<table id="ranking_18013_0" class="competitionRanking tablesorter">
<thead></thead>
<tbody>
<tr class="teamHighlight odd">
<td align="right"></td>
<td></td>
<td class="team"></td>
<td class="number">
34
What I basically want is actually pretty straight forward, i want to be able to retrieve a nested value from a website in VBA. I'm struggling with this for a while now so any help is more than welcome.
Thanks in advance