View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Pick data from web page (no query)

Everything can be obtained on the webpage. You can also press any button or
object on the page . Enter data in Textboxes go to remote links. Anything
you can do with the keyboard and mouse can be done in the code. There are
items like ONCLICK. Run code below and you will see. If you can't find a
label with the item you are looking for you can look in the innertext.

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
End If
Next itm

End Sub





"rik" wrote:

I guess your last post was not relevant because it seems there's only 1 page,
each different page has its own URL. I found out with code below, i tested
either with homepage or with the page that i try to work with.

My conclusion is : the data that i want to transfer into excel are hidden
(you can't refer to them by trheir ID ??). I'm afraid there's no solution.
Hope that i'm wrong ???


===============================
Sub pages()


Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True

'test with either next line
URL =
"https://www.binck.com/gekko/default.aspx?Redir=/gekko/common/researchennieuws/fondsdetails/overzicht.aspx?binc=1068754"

'or next line
'URL = "https://www.binck.nl/gekko/common/inloggen.aspx"

'get web page
IE.Navigate2 URL
Do While IE.readyState < 4
DoEvents
Loop
Set last = IE.document.all
teller = 0
RowCount = 1
For Each itm In IE.document.all
If itm.ID < "" Then
With ActiveSheet

.Range("A" & RowCount) = itm.ID
RowCount = RowCount + 1
End With
Else
'do nothing
End If
teller = teller + 1
If teller = 5 Then
GoTo line1
Else
End If
Next itm
line1:
Range("K1") = 1


If IE.document.getelementsbytagname("B").Length < 0 Then
Set PageNumbers = _
IE.document.getelementsbytagname("B") _
.Item(0).nextsibling

If Not PageNumbers Is Nothing Then
Page = Val(PageNumbers.innertext) - 1
Range("d1") = Page
End If
Else
Set PageNumbers = Nothing
Range("d2") = Page
End If


End Sub
================================================== ==