Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   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)

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 ?

  #2   Report Post  
Posted to microsoft.public.excel.programming
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 ?

  #3   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)

I'm sorry, but i'm not with you anymore :

"objInloggenScreen" ? Does this mean : the ID that i found in the source of
the web page (1068754|LAST, see pasted source in my first post)

add a Watch : i think i could do this although i couldn't find the plus (+)
you mentioned. Running with break point and watch gives me :

Watch : : last : Nothing : Variant/Object : Module1.Getquotes
so value = nothing
on website it is = 350,30

I also do not understand your sentence "When referencing these objects you
will use Last.innertext"

Basically, what i want to do is putting this value (350,30) into cell A1.
What do i do wrong ?


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

You are return nothing because it didn' tfind an ID= matching your criteria.
Try one of my two instruction and you will see it will return a value

Set last = IE.document.getelementsbytagname("Form")

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


Try this code which will get all the ID's. Then in the Internet Explorer
view the Source code from the menu VIEW - SOURCE. You'll see the items in
column A on the spreadsheet will match the ID= in the source

Sub Getquotes2()
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.ID
RowCount = RowCount + 1
End With
End If
Next itm

End Sub



"rik" wrote:

I'm sorry, but i'm not with you anymore :

"objInloggenScreen" ? Does this mean : the ID that i found in the source of
the web page (1068754|LAST, see pasted source in my first post)

add a Watch : i think i could do this although i couldn't find the plus (+)
you mentioned. Running with break point and watch gives me :

Watch : : last : Nothing : Variant/Object : Module1.Getquotes
so value = nothing
on website it is = 350,30

I also do not understand your sentence "When referencing these objects you
will use Last.innertext"

Basically, what i want to do is putting this value (350,30) into cell A1.
What do i do wrong ?


  #5   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)

Thanks for your answer but running your code does not bring anything in the
excel sheet ...
It runs without any failure code but it seems it cannot find any ID's ???

In the web page source though, i found all codes (as shown before) in the
pasted part of the code.
Do you have a solution ?

"Joel" wrote:

You are return nothing because it didn' tfind an ID= matching your criteria.
Try one of my two instruction and you will see it will return a value

Set last = IE.document.getelementsbytagname("Form")

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


Try this code which will get all the ID's. Then in the Internet Explorer
view the Source code from the menu VIEW - SOURCE. You'll see the items in
column A on the spreadsheet will match the ID= in the source

Sub Getquotes2()
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.ID
RowCount = RowCount + 1
End With
End If
Next itm

End Sub



"rik" wrote:

I'm sorry, but i'm not with you anymore :

"objInloggenScreen" ? Does this mean : the ID that i found in the source of
the web page (1068754|LAST, see pasted source in my first post)

add a Watch : i think i could do this although i couldn't find the plus (+)
you mentioned. Running with break point and watch gives me :

Watch : : last : Nothing : Variant/Object : Module1.Getquotes
so value = nothing
on website it is = 350,30

I also do not understand your sentence "When referencing these objects you
will use Last.innertext"

Basically, what i want to do is putting this value (350,30) into cell A1.
What do i do wrong ?




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

Check the ative sheet in the workbook starting at row 1. Here is what I got.
I discovered some of these items are hidden and can't be seen in the source.

objInloggenScreen
frmInloggen
__EVENTTARGET
__EVENTARGUMENT
__LASTFOCUS
__VIEWSTATE
txtJava
lnkLogo
lblWelkom
lblInloggen
lblTaal
DdlLanguage
lblRekNrOfAdviseur
txtLogin
valTxtLogin
txtPassword
btnLogIn
lnkbtnWachtwoordVergeten
__EVENTVALIDATION
oCapsLockWarn

You can get the value of one of these items with

Set last = IE.document.getElementByID("txtLogin")
Data = last.value


"rik" wrote:

Thanks for your answer but running your code does not bring anything in the
excel sheet ...
It runs without any failure code but it seems it cannot find any ID's ???

In the web page source though, i found all codes (as shown before) in the
pasted part of the code.
Do you have a solution ?

"Joel" wrote:

You are return nothing because it didn' tfind an ID= matching your criteria.
Try one of my two instruction and you will see it will return a value

Set last = IE.document.getelementsbytagname("Form")

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


Try this code which will get all the ID's. Then in the Internet Explorer
view the Source code from the menu VIEW - SOURCE. You'll see the items in
column A on the spreadsheet will match the ID= in the source

Sub Getquotes2()
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.ID
RowCount = RowCount + 1
End With
End If
Next itm

End Sub



"rik" wrote:

I'm sorry, but i'm not with you anymore :

"objInloggenScreen" ? Does this mean : the ID that i found in the source of
the web page (1068754|LAST, see pasted source in my first post)

add a Watch : i think i could do this although i couldn't find the plus (+)
you mentioned. Running with break point and watch gives me :

Watch : : last : Nothing : Variant/Object : Module1.Getquotes
so value = nothing
on website it is = 350,30

I also do not understand your sentence "When referencing these objects you
will use Last.innertext"

Basically, what i want to do is putting this value (350,30) into cell A1.
What do i do wrong ?


  #7   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)

I get the same results
Can you explain me what this means for the page i try to work with ?


"Joel" wrote:

Check the ative sheet in the workbook starting at row 1. Here is what I got.
I discovered some of these items are hidden and can't be seen in the source.

objInloggenScreen
frmInloggen
__EVENTTARGET
__EVENTARGUMENT
__LASTFOCUS
__VIEWSTATE
txtJava
lnkLogo
lblWelkom
lblInloggen
lblTaal
DdlLanguage
lblRekNrOfAdviseur
txtLogin
valTxtLogin
txtPassword
btnLogIn
lnkbtnWachtwoordVergeten
__EVENTVALIDATION
oCapsLockWarn

You can get the value of one of these items with

Set last = IE.document.getElementByID("txtLogin")
Data = last.value


"rik" wrote:

Thanks for your answer but running your code does not bring anything in the
excel sheet ...
It runs without any failure code but it seems it cannot find any ID's ???

In the web page source though, i found all codes (as shown before) in the
pasted part of the code.
Do you have a solution ?

"Joel" wrote:

You are return nothing because it didn' tfind an ID= matching your criteria.
Try one of my two instruction and you will see it will return a value

Set last = IE.document.getelementsbytagname("Form")

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


Try this code which will get all the ID's. Then in the Internet Explorer
view the Source code from the menu VIEW - SOURCE. You'll see the items in
column A on the spreadsheet will match the ID= in the source

Sub Getquotes2()
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.ID
RowCount = RowCount + 1
End With
End If
Next itm

End Sub



"rik" wrote:

I'm sorry, but i'm not with you anymore :

"objInloggenScreen" ? Does this mean : the ID that i found in the source of
the web page (1068754|LAST, see pasted source in my first post)

add a Watch : i think i could do this although i couldn't find the plus (+)
you mentioned. Running with break point and watch gives me :

Watch : : last : Nothing : Variant/Object : Module1.Getquotes
so value = nothing
on website it is = 350,30

I also do not understand your sentence "When referencing these objects you
will use Last.innertext"

Basically, what i want to do is putting this value (350,30) into cell A1.
What do i do wrong ?


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pick a cell to go to a sheet in the workbook (greeting page) tom n. Excel Discussion (Misc queries) 4 October 4th 08 03:33 PM
Web Query not downloading data filtered in web page Cesar Zapata Excel Programming 0 October 8th 07 02:39 PM
Extracting data from web page with an imbedded DB query jcalver Excel Programming 1 January 10th 07 07:18 PM
GIF image on web-page corrupts data fetched with Web Query Geoff Lambert Excel Discussion (Misc queries) 0 September 6th 06 12:29 PM
excel web query problem, data not on actual page? Enjoy Life Excel Programming 2 January 24th 04 06:04 PM


All times are GMT +1. The time now is 06:55 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"