Trying to pull data from an API to Excel by reference to a string I type in cell -
was trying pull stocks data api excel using below vba. working if input string directly in url once tried reference stock number cell in sheet, stops working. below vba using:
sub incomeapi2() activesheet.querytables.add(connection:= _ "url ; https://www.quandl.com/api/v3/datasets/rb1/" & activesheet.range("d4") & "0288_income.csv?start_date=2016-12-31&end_date=2016-12-31&api_key=xxxxxxxxxxxxxx" _ , destination:=range("e4")) .name = false .fieldnames = false .refreshstyle = xlinsertdeletecells .rownumbers = false .filladjacentformulas = false .hasautoformat = true .refreshonfileopen = 1 .backgroundquery = false .tablesonlyfromhtml = true .savedata = true .refresh backgroundquery:=false .uselistobject = false end range("e4:e5").select selection.texttocolumns destination:=range("e4"), datatype:=xldelimited, _ textqualifier:=xldoublequote, consecutivedelimiter:=false, tab:=false, _ semicolon:=false, comma:=true, space:=false, other:=false, fieldinfo _ :=array(array(1, 1), array(2, 1), array(3, 1), array(4, 1), array(5, 1), array(6, 1), _ array(7, 1), array(8, 1), array(9, 1), array(10, 1), array(11, 1)) range("e5:p5").cut range("e4") end sub
Comments
Post a Comment