Posted to microsoft.public.excel.programming
|
|
Web Query: Obtaining source link from a cell in a macro
Both worked fine for me.
--
Regards,
Tom Ogilvy
"tx12345" wrote in
message ...
Thnks for the reply.
OK, here is something more specific, and I know this works:
Code:
--------------------
Sub getprice()
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://quote.barchart.com/quote.asp?sym=V4Y0",
Destination:=Range("C1"))
.Name = "quote.asp?sym=V4Y0"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = False
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.WebSelectionType = xlAllTables
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.Refresh BackgroundQuery:=False
End With
End Sub
Code:
--------------------
But when I revise the code to read from A1:
Code:
--------------------
Sub getprice()
With ActiveSheet.QueryTables.Add(Connection:= _
Range("A1").Text, Destination:=Range("C1"))
.Name = "quote.asp?sym=V4Y0"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = False
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.WebSelectionType = xlAllTables
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.Refresh BackgroundQuery:=False
End With
End Sub
--------------------
with A1 containing:
URL;http://quote.barchart.com/quote.asp?sym=V4Y0
I get a debug error
any ideas?
Thx
--
tx12345
------------------------------------------------------------------------
tx12345's Profile:
http://www.excelforum.com/member.php...o&userid=24776
View this thread: http://www.excelforum.com/showthread...hreadid=499085
|