View Single Post
  #2   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)

I'm not sure whnat you are looking for? You can use either

getelementsbytagname which returns a tag item like
<Form ...................... /Form


Or an Id
Set last = IE.document.getElementByID("objInloggenScreen")
<table id="objInloggenScreen" cellSpacing="0" cellPadding="4" border="0"


First, I think you need to look at the source page
from Internet Explorer go to menu View - Source.

Second I think you need to set a break point and look at the objects.
Add a break point just after the SET LAST statement. Click on the
instruction and Press F9.


Next add a Watch. highlight LAST with the mouse and select ADD WATCH. Now
in the Watch window open up the plus (+) sign next to Last. Then do the same
for ITEM if you are using a TAG. When referencing these object you will use
like Last.item(1).innertext (for TAG) or for ID Last.innertext

See code below

Sub Getquotes()
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.getelementsbytagname("Form")

'or
Set last = IE.document.getElementByID("objInloggenScreen")


End Sub


"rik" wrote:

I want to pick a certain streaming value on a webpage and drop it into my
excel sheet, but following testcode won't work properly :
===================
Sub Getquotes()
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.getElementByID("1068754|LAST")
Range("A1") = last

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

This code fails at line : "Range("A1")=last" (failure 1004)

In the html of the webpage i could find :

ID="1068754|LAST" NAME="1068754|LAST" style="width:68px;"356,50<span
class='c4d'00</span</td<td align="right" ID="1068754|TIME"
NAME="1068754|TIME" style="width:68px;"9:42</td<td align="right"
ID="1068754|LASTVOL" NAME="1068754|LASTVOL" style="width:68px;"1</td
</tr<tr class="bkgnd_1"
<td align="left"+/-</td<td class="cQuoteUp" align="right"

etcetc

so i guess the syntax of "Set last= ...etc" is correct ?

What did i do wrong ?