|I don't know if the date is biased off of today, or yesterday, and I don't know how the file is password protected, but this might do what you want. Also, I'm not logging anything; if you're going to use this as an automated task, you should throw in some logging.|
Const user = "user"
Const pass = "password"
Const locRoot = "https://78.XXX.XXX.12/log/"
fileName = FormatDate(Now) & ".csv"
loc = locRoot & fileName
GetFile loc, fileName, user, pass
Function GetFile(sLoc, sFile, sUser, sPass) 'As HTTP status
'Setup output file
Set outFile = CreateObject("ADODB.Stream")
outFile.Type = 2 'Text file
'Setup HTTP request
Set http = CreateObject("WinHttp.WinHttpRequest.5.1")
http.Open "GET", sLoc, False
http.SetCredentials sUser, sPass, 0
GetFile = http.Status
If GetFile = 200 Then
outFile.SaveToFile sFile, 2
Function FormatDate(d) 'As String
FormatDate = DatePart("yyyy", d) & DatePart("m", d) & DatePart("d", d)
How To Ask Questions The Smart Way