Smartgambler
Pro-Punter

Go Back   OZmium Sports Betting and Horse Racing Forums > Public Forums > General Topics
User Name
Password
Register FAQ Search Today's Posts Mark all topics as read

To advertise on these
forums, e-mail us.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 24th August 2012, 01:03 PM
Shaun Shaun is offline
Member
 
Join Date: Jan 1970
Location: Western Australia
Posts: 3,456
Default Excel import Help Requiered

Ok he is a tough one, need help to get this page in to excel but i need the info located under the "Profile" tab, need a macro to do it.

http://horseform.racingandsports.co...4157493D55E8D22

The info is not accessible from the link, would need to access the script on the page, i have some macro that may contain the answer but i am not fully sure it it'd workings.

this macro get data from another site that is not available via a normal web query.
__________________
One Drive

"If the corporates are treating you poorly , just go elsewhere."
"If they need you , they will soon find out."
"If you need them , you will soon find out."
--moeee
_______________________________________________
Reply With Quote
  #2  
Old 24th August 2012, 01:06 PM
Shaun Shaun is offline
Member
 
Join Date: Jan 1970
Location: Western Australia
Posts: 3,456
Default

Here is the code i have for the other site.

Code:
Private Function HttpGetRequest(Url As String) As String 'Function submits a GET request, returns a server response Dim xmlReq As ServerXMLHTTP60 Set xmlReq = New ServerXMLHTTP60 xmlReq.Open "GET", Url xmlReq.setRequestHeader "User-Agent", "Excel 2002 :)" xmlReq.send If xmlReq.Status <> 200 Then MsgBox "Error occured: " & xmlReq.statusText: Exit Function HttpGetRequest = xmlReq.responseText End Function Sub Test() Dim servResp As String Dim htmlDoc As HTMLDocument, myTable As IHTMLTable, myTableRow As IHTMLTableRow, myCell As IHTMLTableCell Dim i As Long, r As Long, c As Long, colSpan As Long 'Record server response into a string variable servResp = HttpGetRequest("http://www.puntingform.com.au/form-guide/race/bathurst-26-06-2012-1-form/") 'Creats a new object, assigns its .body.innerHTML property from server response Set htmlDoc = New HTMLDocument htmlDoc.body.innerHTML = servResp 'If you check your webpage source code _ you'll see that the table you need has a class name 'Table7' _ (table class="Table7"). _ This allows us to use .getElementsByClassName method to _ put this table into a new object of IHTMLTable type. _ There 's only one table on the page page, that's why it's .Item(0) Set myTable = htmlDoc.getElementsByClassName("Table7").Item(0) 'Iterate through each table row in our table rows collection For Each myTableRow In myTable.Rows c = 0 colSpan = 0 'Iterate through each table cell in our table rows collection For Each myCell In myTableRow.Cells 'Table header captions span over several cells: th colspan="7" _ so for 1st row only we need colspan values to later record these cells text _ into appropriate columns in Excel If r = 0 Then colSpan = myCell.getAttribute("colspan") - 1 End If 'Some cells in 2nd row don't have any text. _ But they have IMG tags which have despriptive TITLE attribute we can use If r = 1 Then If Len(myCell.innerText) > 0 Then Sheet1.Range("A1").Offset(r, c) = myCell.innerText Else Sheet1.Range("A1").Offset(r, c) = myCell.getElementsByTagName("IMG").Item(0).getAttribute("TITLE") End If Else Sheet1.Range("A1").Offset(r, c) = myCell.innerText End If c = c + 1 + colSpan Next myCell r = r + 1 Next myTableRow End Sub
__________________
One Drive

"If the corporates are treating you poorly , just go elsewhere."
"If they need you , they will soon find out."
"If you need them , you will soon find out."
--moeee
_______________________________________________
Reply With Quote
  #3  
Old 26th August 2012, 01:06 PM
Shaun Shaun is offline
Member
 
Join Date: Jan 1970
Location: Western Australia
Posts: 3,456
Default

Just an update, i have the info i need.

http://horseform.racingandsports.co...agetype=profile

The information i gained will enable me to gather more info from the R&S site.
__________________
One Drive

"If the corporates are treating you poorly , just go elsewhere."
"If they need you , they will soon find out."
"If you need them , you will soon find out."
--moeee
_______________________________________________
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is On
Forum Jump



All times are GMT +10. The time now is 05:07 AM.


Powered by: vBulletin Version 3.0.3
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
©2008 OZmium Pty. Ltd. All rights reserved . ACN 091184655