excel - Issues when requesting FTP file with VBA -
i trying make part in routine retrieves .xls document ftp location.
i have been googling quite few hours , starting quite frustrated piece of code.
when running code run-time error '3001' saying arguments either of wrong type , out of aceptable range, or in conflict 1 another.
sub getftpfile() dim objxml dim strftpresponse dim varuser, varpassword variant dim localdir string set objxml = createobject("msxml2.xmlhttp") strurl = "ftp://xyz_hourly.xls" localdir = "c//" varuser = "xxx" varpassword = "yyy" call objxml.open("get", strurl, varuser, varpassword, false) call objxml.send while objxml.readystate <> 4 doevents loop set file = createobject("adodb.stream") file.type = 1 file.open file.write objxml.responsebody file.savetofile "c//yyy.xlsx", 2 end sub
Comments
Post a Comment