View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Include cell text in web hyperlink?

As I said, this could be set up with a looping macro on the one query to do
the fetchcopy the desired data to where ever is necessarydo the same for
the next symbol. Even better when a .csv where you can bring in all symbols
(Yahoo allows 200 at at time and you can also loop that for an infinite
number) with ONLY ONE fetch. and then do TTC to separate.

With Sheets(2).QueryTables.Add(Connection:="URL;" _
& "http://download.finance.yahoo.com/d/quotes.csv?s=" & _
symbols & "&f=snd1t1l1ohgpvqyd&e=.csv", _
Destination:=Sheets("Data").Cells(dr, dc))
.BackgroundQuery = True
.TablesOnlyFromHTML = False
.Refresh BackgroundQuery:=False
.SaveData = True
End With

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Joel" wrote in message
...
that code will only work for 1 stock and only when you change the company
name. It will not work when there are multiple stocks on the same sheet.
The problem is with queries is the connection property cannot be changed
once
the query is initiated. You have only on querytable in your code.

"Don Guillett" wrote:

And of course you could always set up a refresh of an external query tied
to
a worksheet_change event or a looping macro. May not want all 4 tables?

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address < Range("a1").Address Then Exit Sub
With ActiveSheet.QueryTables(1)
.Connection = _
"URL;http://www.schaeffersresearch.com" & _
"/streetools/stock_quotes.aspx?Ticker=" & Range("a1")
.Refresh BackgroundQuery:=False
End With
End Sub
Last 23.44
High 23.53
Prev Close 23.44
52Wk Low 20.9

Change
Low 23.39
Dividend Date 7/8/2009
EPS 2.12

% Change 0.00%
Volume 1,644,898
Dividend Amount 1.64
Shares Out 5,900,000,000

Open 23.53
52Wk High 33.56
P/E Ratio 11.6
Yield 6.7



--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Joel" wrote in message
...
Don: Your code just goes to the webpage and doesn't return any values.
Try
my code and you will see the differences.

"Don Guillett" wrote:

Right click sheet tabview codeinsert thisthen enter ge or ibm or t
into
any cell in col M

Private Sub Worksheet_Change(ByVal target As Range)
If target.Column < 13 Then Exit Sub
ActiveWorkbook.FollowHyperlink Address:= _
"http://www.schaeffersresearch.com/streetools/" & _
"stock_quotes.aspx?Ticker=" & target.Value & ""
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Doug" wrote in message
...
Here is an example:
http://www.schaeffersresearch.com/st...s.aspx?Ticker=

is the URL and if I want click on the cell with GE in it, then it
should
automatically go to:
http://www.schaeffersresearch.com/st...aspx?Ticker=GE

I am needing it to do this for any cell in column M
--



"Joel" wrote:

If I rretrhad the URL I can write some code. The best solution
would
be
to
have a control button which you can activate. The control button
can
open an
internet explorer application which can automatically retreve the
data
from
the URL and place the data into you worksheet.

If the URL is not public then I can send you some examples of code
that
would perform the task. Working with the internet explorer
application
is a
litle tricky b eause every webpage is different. Knowing html will
help.

"Doug" wrote:

I have a hyperlink to a web database. Up till now I have been
clicking
on the
hyperlink and once it takes me to that web page I then include a
cell
reference from excel at the end of the web address to obtain the
data
that I
need. What I am hoping is that I can have excel somehow include
or
attach
the text in the cell to the end of the hyperlink when I click on
the
cell.
This would be very helpful. Is this possible?
--
Hope your having a great day!