Вы находитесь на странице: 1из 1

Sub Sample()

Dim ws As Worksheet
Dim LastRow As Long, i As Long
Dim strPath As String
'~~> Name of the sheet which has the list
Set ws = Sheets("Sheet1")
LastRow = ws.Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To LastRow '<~~ 2 because row 1 has headers
strPath = FolderName & ws.Range("A" & i).Value & ".jpg"
Ret = URLDownloadToFile(0, ws.Range("B" & i).Value, strPath, 0, 0)
If Ret = 0 Then
ws.Range("C" & i).Value = "File successfully downloaded"
Else
ws.Range("C" & i).Value = "Unable to download the file"
End If
strPath = FolderName & ws.Range("A" & i).Value & "__NORMAL.jpg"
Ret = URLDownloadToFile(0, ws.Range("G" & i).Value, strPath, 0, 0)
If Ret = 0 Then
ws.Range("H" & i).Value = "File successfully downloaded"
Else
ws.Range("H" & i).Value = "Unable to download the file"
End If
strPath = FolderName & ws.Range("A" & i).Value & "__TERRAIN.jpg"
Ret = URLDownloadToFile(0, ws.Range("K" & i).Value, strPath, 0, 0)
If Ret = 0 Then
ws.Range("L" & i).Value = "File successfully downloaded"
Else
ws.Range("L" & i).Value = "Unable to download the file"
End If
Next i
End Sub

Вам также может понравиться