View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Charalampos Charalampos is offline
external usenet poster
 
Posts: 2
Default Code to get data from webpage into Excel (v.2)

I read the article "Code to get data from webpage into Excel" while
I was searching to solve my problem.

Actually is quite similar to "donbowyer" 's problem. The code is
:

Sub TheSub()
'Microsoft Internet Controls
'Microsoft HTML Object Library

Dim myIE As InternetExplorer
Dim myDoc As MSHTML.HTMLDocument
Dim myImg As MSHTML.HTMLImg
Dim mySiteUrl As String
Dim E As MSHTML.HTMLGenericElement

MyDay = Format(Now, "YYYYMMDD")

mySiteUrl = "http://tv.pathfinder.gr/" 'URLhp
Set myIE = New InternetExplorer

With myIE
' .Visible = True
.Navigate mySiteUrl
Do Until .readyState = READYSTATE_COMPLETE: Loop
.Document.all.searchDt.Value = mDay
.Document.all.searchChannel.Value = "mega"
.Document.all.searchType.Value "0"
.Document.all.doSearch.Click
Do Until .readyState = READYSTATE_COMPLETE: Loop

Set myDoc = .Document

With myDoc
ActiveSheet.Cells(1, "A").Value = .body.innerText
End With

End With

myIE.Quit
Set myIE = Nothing
Set myDoc = Nothing
End Sub

The purpose is to go to the startpage : http://tv.pathfinder.gr/" ,
put 3 criteria programmatically (mDay, "mega", "0"), do the
Search (doSearch.Click) and after the page has loaded with the results
to get the results (the table with the TV program) in the active sheet.
The problem is that I get data from the first page not from the page
with the results (second page). Any suggestions would be most welcome.

Charalampos