Importing data from web page with diffrent Dates in excel using VBA code -
i don't know how import info web site ,which need since 1st of july 2012 until present. ideas guys?? don't know how since url changes. want import info since july 2012 until can through html source of web page?
sub websitee() activesheet.querytables.add(connection:= _ "url;http://www.epexspot.com/en/market-data/intraday", destination:=range( _ "$a$1")) .name = "intraday" .fieldnames = true .rownumbers = false .filladjacentformulas = false .preserveformatting = true .refreshonfileopen = false .backgroundquery = true .refreshstyle = xlinsertdeletecells .savepassword = false .savedata = true .adjustcolumnwidth = true .refreshperiod = 0 .webselectiontype = xltables .webformatting = xlwebformattingnone .webpreformattedtexttocolumns = true .webconsecutivedelimitersasone = true .websingleblocktextimport = false .webdisabledaterecognition = false .webdisableredirections = false .refresh backgroundquery:=false union(columns(3), columns(4), columns(5), columns(7), columns(8), columns(9)).delete end end sub
next iteration: can phone call downloadperiod , should drop info on number 1 worksheets per day in jan 2012. please test , can go on next iteration of code.
sub downloaddayfromuser() dim sinput string sinput = inputbox("enter date in yyyy-mm-dd format") phone call websitee(sinput) end sub sub downloadperiod() dim downloadday date downloadday = #1/1/2012# while downloadday < #1/2/2012# ' create new workbook set info activeworkbook.worksheets.add ' phone call web service today phone call websitee(format(downloadday,"yyyy-mm-dd")) ' increment day downloadday = downloadday + 1 loop end sub sub websitee(sdate string) activesheet.querytables.add(connection:= _ "url;http://www.epexspot.com/en/market-data/intraday/" & sdate & "/", destination:=range( _ "$a$1")) .name = "intraday" .fieldnames = true .rownumbers = false .filladjacentformulas = false .preserveformatting = true .refreshonfileopen = false .backgroundquery = true .refreshstyle = xlinsertdeletecells .savepassword = false .savedata = true .adjustcolumnwidth = true .refreshperiod = 0 .webselectiontype = xltables .webformatting = xlwebformattingnone .webpreformattedtexttocolumns = true .webconsecutivedelimitersasone = true .websingleblocktextimport = false .webdisabledaterecognition = false .webdisableredirections = false .refresh backgroundquery:=false union(columns(3), columns(4), columns(5), columns(7), columns(8), columns(9)).delete end
end sub
excel vba date webpage
No comments:
Post a Comment