jeffcoleky
Active Member
- Joined
- May 24, 2011
- Messages
- 274
Code:
Dim URL As StringDim LocalFileName As String
Dim B As Boolean
Dim ErrorText As String
Dim C As Range
Dim sTxt As String
sTxt = Cells(1, "a").Value
Dim Lastrow As Long
Lastrow = Range("C:D").Find("*", , , , xlByRows, xlPrevious).Row
For Each C In Range("C1:D" & Lastrow)
If Len(C) > 0 Then
URL = C.Text
[B] LocalFileName = "C:\temp\" & Range("A" & C.Row) & " " & Range("A" & C.Row) & " " & Evaluate("TRIM(RIGHT(SUBSTITUTE(""" & C.Text & """,""/"",REPT("" "",1000)),1000))")[/B]
B = DownloadFile(UrlFileName:=URL, _
DestinationFileName:=LocalFileName, _
Overwrite:=DoNotOverwrite, _
ErrorText:=ErrorText)
If B = True Then
Debug.Print "Download successful"
Else
Debug.Print "Download unsuccessful: " & ErrorText
End If
End If
Next C
End Sub
Currently, this code does not include the data in column C in the local filename. However, I would like it to. The dates in column C are formatted as "mm'dd/yyyy" but I'm OK with the local filename formatted as "mmddyyy" or "mm-dd-yyyy".
Can anyone help me update the code above to include the date value in column C for each line?