Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Little help - Quotes in VBA

Hey guys,

Was wondering if anyone knew how to load a webpage into memory and
pull a specific quote using a function.

For example I would want to write a function =BBQuote(CLLRUIB,LX) or
=BBQuote(CSCOMPU,SW)

to get the NAV from these webpages


http://www.bloomberg.com/apps/quote?ticker=CLLRUIB%3ALX
http://www.bloomberg.com/apps/quote?ticker=CSCOMPU%3ASW
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Little help - Quotes in VBA

One way is to write a looping macro that gets the data from an external
query and then copies to the right of the ticker symbol requested.
CLLRUIB,LX 134.15
CSCOMPU,SW 7.25

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Fidel" wrote in message
...
Hey guys,

Was wondering if anyone knew how to load a webpage into memory and
pull a specific quote using a function.

For example I would want to write a function =BBQuote(CLLRUIB,LX) or
=BBQuote(CSCOMPU,SW)

to get the NAV from these webpages


http://www.bloomberg.com/apps/quote?ticker=CLLRUIB%3ALX
http://www.bloomberg.com/apps/quote?ticker=CSCOMPU%3ASW


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Little help - Quotes in VBA

I brought back every thing fro the website. Lots of people have done this
before. chenge Ticker as required.

Sub Bloomberg()

URL = "http://www.bloomberg.com/apps/quote?ticker="
Ticker = "CLLRUIB%3ALX"


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


'get web page
IE.Navigate2 URL & Ticker
Do While IE.readystate < 4 Or _
IE.busy = True

DoEvents
Loop


Colcount = 1
RowCount = 1
Set Table = IE.document.getelementsbytagname("Table")
For TableCount = 2 To 7
For Each Row In Table(TableCount).Rows
'Colcount = 1
For Each cell In Row.Cells
'MyStr = cell.innertext
'For i = 1 To Len(MyStr)
'Range("A" & RowCount) = Mid(MyStr, i, 1)
'Range("B" & RowCount) = Asc(Mid(MyStr, i, 1))
'RowCount = RowCount + 1
'Next i

Cells(RowCount, Colcount) = cell.innertext
Colcount = Colcount + 1
Next cell
Next Row
Next TableCount
IE.Quit
End Sub

"Fidel" wrote:

Hey guys,

Was wondering if anyone knew how to load a webpage into memory and
pull a specific quote using a function.

For example I would want to write a function =BBQuote(CLLRUIB,LX) or
=BBQuote(CSCOMPU,SW)

to get the NAV from these webpages


http://www.bloomberg.com/apps/quote?ticker=CLLRUIB%3ALX
http://www.bloomberg.com/apps/quote?ticker=CSCOMPU%3ASW
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
ron ron is offline
external usenet poster
 
Posts: 118
Default Little help - Quotes in VBA

On Nov 15, 2:40*pm, Fidel wrote:
Hey guys,

Was wondering if anyone knew how to load a webpage into memory and
pull a specific quote using a function.

For example I would want to write a function *=BBQuote(CLLRUIB,LX) or
=BBQuote(CSCOMPU,SW)

to get the NAV from these webpages

http://www.bloomberg.com/apps/quote?...r=CSCOMPU%3ASW


Fidel...This is fast (good if you're doing a lot of these) and
simple...Ron

Sub quotes()
my_url = "http://www.bloomberg.com/apps/quote?ticker=CLLRUIB%3ALX"
Set my_obj = CreateObject("MSXML2.XMLHTTP")
my_obj.Open "GET", my_url, False
my_obj.send
my_var = my_obj.responsetext
Set my_obj = Nothing

pos_1 = InStr(1, my_var, "QuoteTableData", vbTextCompare)
pos_2 = InStr(pos_1, my_var, "", vbTextCompare)
pos_3 = InStr(pos_2, my_var, "<", vbTextCompare)
my_NAV = Mid(my_var, 1 + pos_2, pos_3 - (1 + pos_2))

' now do what you want with my_NAV

End Sub

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
change straight quotes to curly quotes callico Excel Discussion (Misc queries) 2 June 22nd 07 10:23 PM
How do i get historical stock quotes using MSN Money Stock Quotes Ash Excel Discussion (Misc queries) 0 May 11th 06 03:26 AM
Using CSV and quotes Neil Excel Discussion (Misc queries) 4 October 31st 05 07:59 PM
Quotes PastorMike Excel Programming 1 May 4th 04 03:58 PM
Quotes Frank Kabel Excel Programming 0 May 4th 04 02:52 PM


All times are GMT +1. The time now is 06:51 PM.

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

About Us

"It's about Microsoft Excel"