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
 
The data isn't really in the HTML, it's in a table which is in a frame.

I really don't think either innerHTML or outerHTML will help.

You could of course get both those properties but to extract the actual data in a reasonable form would be a parsing nightmare.:)
 
Upvote 0

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
i don't care about parsing, i already have the code that can do that. Based on your response I just need to find a way to get into the frame.
 
Upvote 0
Well I'm sorry but I can't help any further - you say you have the code to parse, so can't you use it?:)
 
Upvote 0
Well I'm sorry but I can't help any further - you say you have the code to parse, so can't you use it?:)

ok thanks

and yes i have the code to parse but i can't bring in all the source code with VBA, i can get everything but the data within the page (ie .innerHTML and .outerHTML) cet the main HTML code but not the inner data

to use my parsing code i would need to go to the site, save the source code to a file than have my vba parse that data, ideally i would like VBA to do it all (yes i am lazy, that is why i have self taught myself VBA!)
 
Upvote 0
Why would you need to save the source code?

If you have access to the HTML then you should be able to use it in the VBA.:)
 
Upvote 0
I have access to it when i do the right click view source, i can't get the same html source in when i use the only 2 commands i know in VBA innerHTML and outerHTML
 
Upvote 0
Well there's quite a lot of other commands you can use when working with webpages via VBA.

Have a look here.

In particular you might want to look at some of the GetElement... stuff.:)
 
Upvote 0
I know this is an old thread but I am having the exact same problem and am wondering if you ever solved it.

My example is very similar. I have a site where I need to pull data from. I can right click in the desired frame and go to view source and see what I need. The problem is when using either innerHTML or outerHTML I get a result that does not contain the data within that frame.
 
Upvote 0
How are you using innerHTML/outerHTML?

Are you correctly referring to the frame?
 
Upvote 0
I have tried the following:
ie.Document.all(0-12).innerHTML
ie.Document.all(0-12).outerHTML
ie.Document.all(0-12).innerText
ie.Document.all(0-12).outerText
ie.document.Body.innerHTML
ie.document.Body.outerHTML
ie.document.body.innerText
ie.document.body.outerText

If I right cilck on that frame and go to view source I see this line "var page_source="/Eligibility/cas_ELcontent.jsp" which makes me think things may be more complicated because this is a JSP page. I'd post the site in question but unfortunately it is password protected.
 
Upvote 0

Forum statistics

Threads
1,224,825
Messages
6,181,190
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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