View Single Post
  #15   Report Post  
Posted to microsoft.public.excel.programming
Rik Rik is offline
external usenet poster
 
Posts: 16
Default Pick data from web page (no query)

1) same results, 9 empty items found
2)IE="Windows Internet Explorer" type=variant/object//
AddressBar=true//
Application:no variables type=Object/Webbrowser2//
Busy=false//
Container=nothing//
Document:no variabloes type=Object/HTMLDocument//
FullName=c:/programfiles/internetexplorer/iexplore.exe//
etcetc
LocationName="BinckBank" //
LocationURL :
"https://www.binck.com/gekko/default.aspx?Redir=/gekko/common/researchennieuws/fondsdetails/overzicht.aspx?binc=1068754" //
MenuBar=true //
Name="WindowsInternetExplorer //
Offline=false //
Parent:novariables type=Object/WebBrowser2 //
Readystate=READYSTATE_COMPLETE
RegisterAsBrowser = false //
RegisterAsDropTarget=true //
etc
Silent=false
Statusbar=true
Statustext="ready"
etcetc
Type="HTML-document"
etc
3) i printed this from the start (8 pages) : no more ideas as far as i'm
concerned ...

Thanks for your help anyway !!



"Joel" wrote:

There are 3 things I would still do.

1) Put break point before the loop to load data on the wroksheet. Wait 2
minutes and run code. Then check again if there is data in the worksheet
2) Add as a watch IE. Go back to break point in i1) above and set what
objects are under IE. You may be able to figure out if it is not a document
what it really is. Maybe an Excel or Access Object
3) View source in Internet explorer of the new webpage you are viewing.
Maybe there are some comments to help you figure out what to do.

"rik" wrote:

It's not reason nr. 2 : i changed the code a little bit (see below) and got
as a result :
nothing in colums AE
cell F1 = 1
cell G1 = 1, G2=2 etc untill G9=9

Setting a break point didn't change anything.

So probably it's reason nr. 1
Guess there's nothing to do about it ?

===========================================
Sub DumpData()
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
URL = "https://www.binck.com/gekko/default.aspx?" & _
"Redir=/gekko/common/researchennieuws/fondsdetails/overzicht.aspx?binc=1068754"

'get web page
IE.Navigate2 URL
Do While IE.readyState < 4
DoEvents
Loop

Set last = IE.document.all
RowCount = 1
For Each itm In IE.document.all
If itm.ID < "" Then
With ActiveSheet
.Range("A" & RowCount) = itm.classname
.Range("B" & RowCount) = itm.tagname
.Range("C" & RowCount) = itm.onclick
.Range("D" & RowCount) = itm.ID
.Range("E" & RowCount) = Left(itm.innertext, 1024)
RowCount = RowCount + 1
End With
Else
Range("G" & RowCount) = RowCount
RowCount = RowCount + 1
End If
Next itm
Range("F1") = 1
End Sub

=====================================



"Joel" wrote:

there are two possible reasons that I can immediately think of that may be
causing the problem.

1) That the items are not in the IE.Document. It is something else beside a
document.
2) The code isn't waiting for the webpage to get the data before it reads
the data.

I usually set break points a first get the code working by stepping through
the instructions. I can wait until the webpage is updated before continue to
step through the code. Then I go back and try to get it to work
automatically. Here is a sample of code where I couldn't get the IE READY to
wrok. I had to use a return value from the page to force the code to wait.


'get search button
Set but = IE.document.getElementById("mainSearchButton")
'put distance in listbox on webpage
Set radius = IE.document.getElementById("radius")
radius.Value = "100"


'search again a larger distance
'Select Search button and activate
but.Select
but.Click

On Error Resume Next ' Defer error handling.
Do
Err.Clear
Set PageNumber = IE.document.getElementById("pageNumber")
Pages = PageNumber.Value
DoEvents
Loop While Err.Number < 0
On Error GoTo 0


"rik" wrote:

I'm sorry to say but i tried "dumpdata" with 3 web pages :

1. the page to log in (which you can see as well) : it works perfectly well
2. the home page you get on once you're logged in : it runs without failure
but nothing is dumped into the excel sheet : he finds 9 empty items
3. the page i wanted to work with : same as 2 : also 9 empty items, so it
seems to be the same page, although a different page is seen on the screen

There must be something tricky that i don't understand ???
Does it make sense to try to go to the wanted page by filling in name and
password, and then click 2 buttons automatically ?