PDA

View Full Version : Importing from Internet Explorer



dicepackage
04-20-2011, 01:48 PM
I have a program that I want to get the HTML from a website and then extract the information so that I can put it in an access database. The problem is I can retrieve only a portion of the HTML. The site I am using uses frames and JSP. I am not sure which one is the source of the problem. I can right click inside the page itself and go to view source and see everything I need. The problem is I have tried both innerHTML and outerHTML statements but I am unable to get the same code as when I right click and go to view source. Is there some other statement that will get everything or just the data inside this frame?

I am not able to post the link since the site requires a login. I did see someone posted the same problem with the link below so if I can solve it for this one I can probably get it working on mine.
http://www.hockeyligan.se/index.php?estat=%2fc%2fLPlayersPoints.aspx%3fLId%3d195%26NumberOfRows%3dall


Private Sub CommandRun_Click()
Dim wwwAdd As String
wwwAdd = "http://www.hockeyligan.se/index.php?estat=%2fc%2fLPlayersPoints.aspx%3fLId%3d195%26NumberOfRows%3dall"
Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.Navigate wwwAdd
Do While ie.busy
DoEvents
Loop
MsgBox CStr(ie.Document.body.outerHTML)
End Sub

orange
04-20-2011, 05:42 PM
I saw this link dealing with Screen scraping and Vba with Access

http://www.access-programmers.co.uk/forums/showthread.php?t=176968

dicepackage
04-21-2011, 06:06 AM
I saved that link because it will definitely be helpful in the future but it didn't really address my problem. I still can't see any of the code inside that frame unless I right click and go to view source manually.

dicepackage
04-21-2011, 07:44 AM
I have a correction it uses iFrames not frames in case that makes any difference.

orange
04-21-2011, 12:44 PM
I don't know. I haven't used any of these things in any depth, and anything I did do was in 2005 -6 timeframe.

I did find some old code, but it is from 2006. Don't know if it will help, but it's all I've found. Good luck.

Function SaveWebFile(ByVal vWebFile As String, ByVal vLocalFile As String) As Boolean
Dim oXMLHTTP As Object, vFF As Long, oResp As String
Set oXMLHTTP = CreateObject("Microsoft.XMLHTTP")
oXMLHTTP.Open "GET", vWebFile, False
oXMLHTTP.Send
oResp = oXMLHTTP.ResponseText
vFF = FreeFile
If Dir(vLocalFile) <> "" Then Kill vLocalFile
Open vLocalFile For Output As #vFF
Print #vFF, oResp
Close #vFF
Set oXMLHTTP = Nothing
End Function

'---------------------------------------------------------------------------------------
' Procedure : test_SaveWebFile
' DateTime : 2006-10-16 12:08
' Author : orange
' Purpose : Procedure to test the SaveWebFile function
'---------------------------------------------------------------------------------------
'
Sub test_SaveWebFile()
Dim myfile As String
Dim myHtmlPage As String
myfile = "C:\temp\testWebPage.txt"
myHtmlPage = "http://www.diligens.com"
Call SaveWebFile(myHtmlPage, myfile)
End Sub