Getting the entire HTML source code from a web page

Chinnick

New Member
Joined
Sep 9, 2009
Messages
12
I am looking to read the source code for a website that keeps the stats for a hockey league in Sweden

For other sites i can use the code below and it works fine, but the site i am using to get the Sweden stats seem to keep the data in some type of a Java app (sorry still somewhat of a newbie) and doesn't work the same as the others

when i veiw the source code just by right clicking the page all the data i want shows up. When i try to use my code it doesn't get the stuff i want.

I have tried both objDoc.body.innerHTML and objDoc.body.outerHTML and i get different results but not the same as right clicking on the page and viewing the source, is there another command that i can use to get it all?

the website is
HTML:
http://estat.hockeyligan.se/c/LPlayersPoints.aspx?LId=195&NumberOfRows=all


Code:
Sub Get_Stats()
Const strURIpre As String = "http://estat.hockeyligan.se/c/LPlayersPoints.aspx?LId=195&NumberOfRows=all"
Set ie = CreateObject("internetexplorer.application")
ie.Navigate strURIpre
Do
If ie.ReadyState = 4 Then
ie.Visible = False
Exit Do
Else
DoEvents
End If
Loop
Set objDoc = ie.Document
Stop
strMyPage = objDoc.body.innerHTML
ie.Quit
Set objDoc = Nothing
Set ie = Nothing
End Sub

Thanks in advance
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
That data is not in some sort of 'Java app' as far as I can see.

I'm saying that mainly because a Java app, as far as I'm aware anyway, doesn't hold data.

What data is it you want to get?

I took a look at the site - it's pretty complicated and my knowledge of ice hockey has diminished since they stopped showing it on the TV.:)

I'll take another look later - perhaps after I've watched the opening ceremony in Canada.
 
Upvote 0
Here is one line from the source code that i would like to be able to pick out

Johan Davidsson<TD style="HEIGHT: 30px" align="right"></TR><TR></TD>

i can get this when i right click and view source, but not when i use .innerHTML or .outerHTML

Sorry i tried to paste more of the line of HTML code that i want but it converts it to HTML, basically i just need to get the HTML source that shows the names, inner and outerHTML won't do that for me.
 
Last edited:
Upvote 0
Sorry for the double post but they seem to be posting funny on me



Here is one line from the source code that i would like to be able to pick out

Johan Davidsson<TD style="HEIGHT: 30px" align="right"></TR><TR></TD>

i can get this when i right click and view source, but not when i use .innerHTML or .outerHTML

Sorry i tried to paste more of the line of HTML code that i want but it converts it to HTML, basically i just need to get the HTML source that shows the names, inner and outerHTML won't do that for me.
 
Upvote 0
Johan

I've taken another look at the page and the HTML behind it seems pretty complicated.

For a start the table you seem to want data from is within an iframe tag.

I've worked with frames before but not for some time - I'll take a look into it.:)
 
Upvote 0
Johan Davidsson is actually a name in the code that i want to be able to pull out, when i copied more than just that it wouldn't show up because it was HTML code

thanks in advance
 
Upvote 0
Oops - my bad, I thought that was your sig.:oops:

I've taken another look at the site but it really is pretty complicated.

I think what you might need/want to do is follow the hyperlink that is the source of the frame.

I'm still trying to work out how to get the data.

I've done it in the past but I've lost the code that I used to do it.

Well not lost exactly - just not got round to retrieving it from my old hard drive.:)
 
Upvote 0
it seems that the hyperlink i need is
HTML:
"http://estat.hockeyligan.se/c/LPlayersPoints.aspx?LId=195&NumberOfRows=all"

that brings up the exact page i want, but when i do that through VBA the same stuff doesn't show up as when i do a right click view source
 
Upvote 0
Sorry but that link still leads to a page with the aforementioned frames.

I'm also unsure what you mean by right clicking/view source, I thought you wanted the data not the HTML.:)
 
Last edited:
Upvote 0
the data i want is in the source code for the HTML

it the past i have either used in excel New Web Query to get my data but it doesn't work for this site for some reason.
Another way i get data from the site is to use my code i posted above using the .innerHTML which allows me to copy the HTML source codeto a string and then i pull out what i need from it, that again doesn't work for this site.
If i just go to the webpage i have listed and rigth click on it and veiw source (IE) it will bring up all the source code for the page including the data i am after. I just can't find the proper "command" to do that in VBA as the only 2 i know ".innerHTML" and "outerHTML" get some source code (both different) but not the main data i am after
 
Upvote 0

Forum statistics

Threads
1,215,514
Messages
6,125,273
Members
449,219
Latest member
daynle

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top