resim indirmek

Katılım
6 Ocak 2020
Mesajlar
5
Excel Vers. ve Dili
Excel 2016, Türkçe
merhabalar arkadaşlar hemen soruma geçeyim 2 sutun var 1000 e yakın veri var sutun 1 de resim urlsi sutun 2 de resim ismi yazıyor ben. bu resimleri soldaki isme göre nasıl indirebilirim bir isimin birden fazla resimi olabiliyor
 
Katılım
6 Ocak 2020
Mesajlar
5
Excel Vers. ve Dili
Excel 2016, Türkçe

Burada istediğim şey yapılmış ve çalışıyor ama benim 7 sutunum daha var yani A sutunu isim B sütunu url C sütunu 2. url D 3. url diye gidiyor. Verdiğim linkte A sütunundaki ismi alıyor B sütunundaki urlyi indiriyor ve ismini A sütunundaki veri yapıyor B,C,D,E,F sütunlarını indirmiyor

Kod bu

Kod:
Option Explicit

Private Declare Function URLDownloadToFile Lib "urlmon" _
Alias "URLDownloadToFileA" (ByVal pCaller As Long, _
ByVal szURL As String, ByVal szFileName As String, _
ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long

Dim Ret As Long

'~~> This is where the images will be saved. Change as applicable
Const FolderName As String = "C:\Temp\"

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
    Next i
End Sub
 
Üst