Function RequestDownload(URL$, FILE$) As Boolean
Dim B() As Byte, F%
With CreateObject("WinHttp.WinHttpRequest.5.1")
.Open "GET", URL, False
.setRequestHeader "DNT", "1"
On Error GoTo Fin
.send
If .Status = 200 Then
B = .responseBody
F = FreeFile(1)
Open FILE For Binary As #F
Put #F, , B
Close #F
RequestDownload = True
End If
Fin:
End With
End Function
Sub Demo()
SRC$ = "http://fr.louisvuitton.com/images/is/image/lv/1/PP_VP_AS/louis-vuitton--M41746_PM2_Front view.jpg"
LFN$ = "D:\Tests\louis-vuitton-M41746_PM2_Front view.jpg"
If RequestDownload(SRC, LFN) Then
Cells(5).Select
ActiveSheet.Pictures.Insert LFN
End If
End Sub