Paste string on a cell to New Web Query URL

V

vovlov

Hi!

I want to be able to copy an URL address to the New Web Query addres
bar, by editing this macro:

---------------------------------
With ActiveSheet.QueryTables.Add(Connection:= _
_-\"URL;http://finance.yahoo.com/q?s=SSL\"-_
Destination:=Range("H15"))
.Name = "q?s=SSL_7"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "15"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
 
D

Don Guillett

I assume you want to change the symbol? You can use this idea where cell a1
contains SSL

With ActiveSheet.QueryTables.Add(Connection:= _

With ActiveSheet.QueryTables.Add(Connection:= _
_-\"URL;http://finance.yahoo.com/q?s=" & [a1] & "\"-_,

Also, you probably?? only need a few parameters

..BackgroundQuery = True
..TablesOnlyFromHTML = False
..Refresh BackgroundQuery:=False
..SaveData = True


Be aware that doing it the way you are will build a new defined name with
each trip to the site so you will need to incorporate something like. If
other named cell, exclude them.

For Each Name In Sheets("Data").Names
Name.Delete
Next Name


Goto this web site and get some of the free files there such as my
YahooMultipleQuotes 'to get many at once
Look for mine under author donalb36
To visit your group on the web, go to:
http://groups.yahoo.com/group/xltraders/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top