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
Sub DownLoadPicture()
myPath = ThisWorkbook.Path
i = 1
Do Until Cells(i + 1, 1) = ""
myFolder = myPath & "\" & Cells(i, 1)
fileName = Cells(i, 2) & ".jpg"
fileLink = Cells(i, 3)
MkDir myFolder
If URLDownloadToFile(0&, fileLink, myFolder & "\" & fileName, 0&, 0&) = 0 Then
Else
MsgBox "Failure"
End If
i = i + 1
Loop
End Sub
注:如果是64位系统,要在第一行的Declare后面加上PtrSafe,即....Declare PtrSafe Function....