vba - Fetch Website data into Excel -
the recent answer fetch website data excel was:
sub fetchdata() activesheet.querytables.add(connection:= _ "url;http://www.zillow.com/homes/comps/67083361_zpid", destination:=range( _ "$a$1")) .fieldnames = true .rownumbers = false .filladjacentformulas = false .preserveformatting = true .refreshonfileopen = false .backgroundquery = true .refreshstyle = xlinsertdeletecells .savepassword = false .savedata = true .adjustcolumnwidth = true .refreshperiod = 0 .webselectiontype = xlentirepage .webformatting = xlwebformattingnone .webpreformattedtexttocolumns = true .webconsecutivedelimitersasone = true .websingleblocktextimport = false .webdisabledaterecognition = false .webdisableredirections = false .refresh backgroundquery:=false end end sub
it works project except url of interest is:
url;http://reservations.example.com/cp/reports/daily_usage.php?type=date_reservations&date=06%2f03%2f2015&date_end=&vessel=&club=6&location=135", destination:=range( _ "$a$1"))
i have used fake url above privacy reasons, can see, url has date code within. in case june 3rd, 2015 designated 06%2f03%2f2015
.
using vba, how can make date within url variable, defined within work sheet?
with format()
function probably. wild guess be
format(range("$a$1").value2, "mm""%2f""dd""%2f""yyyy")
you can reconstruct using day()
, month()
, year()
functions , playing around iif(len(x)=2,x,0&x)
.
sample gave "06%2f03%2f2014" 2014-06-03.
Comments
Post a Comment