excel - QueryTable not being created -


i trying call information yahoo finance keep on getting error saying url trying use not giving information. when manually put url in data , when use url in .iqy file works. got following vba code when recorded macro, macro doesn't run.

sub getandarrangedata() ' ' getandarrangedata macro ' ' keyboard shortcut: option+cmd+b '     activesheet.querytables.add(connection:= _         "url;http://real-chart.finance.yahoo.com/table.csv?s=1112.hk&d=4&e=15&f=2015&g=d&a=5&b=27&c=2000&ignore=.csv" _         , destination:=range("c3"))         .posttext = "msn moneycentral stock quotes_1"         .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     columns("c:c").select     selection.texttocolumns destination:=range("c1"), datatype:=xldelimited, _         textqualifier:=xldoublequote, consecutivedelimiter:=false, tab:=true, _         semicolon:=false, comma:=true, space:=false, other:=false, fieldinfo _         :=array(array(1, 5), array(2, 1), array(3, 1), array(4, 1), array(5, 1), array(6, 9), _         array(7, 9))     columns("d:f").select     selection.entirecolumn.hidden = true end sub 

i following error each time :

enter image description here

for reason ampersands in url vanish, no idea why.

for completeness, copying answer comment here:

replace &s in url string &&s.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -