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
Function
Image_Download(strImgURL
As
String
, img
As
MSForms.Image)
Dim
lngRC
As
Long
, strTempFile
As
String
, ret
strTempFile =
"C:\temp\anyfilename.jpg"
lngRC = URLDownloadToFile(0, strImgURL, strTempFile, 0, 0)
If
ret
Then
MsgBox
"The image download failed"
, vbExclamation
Else
img.Picture = LoadPicture(strTempFile)
Kill strTempFile
End
If
End
Function