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 Test()
'Change url to the bmp
Const strUrl As String = "http://www.exceltip.com/images/newsite/hdr_bg.jpg"
Dim strSavePath As String
Dim returnValue As Long
strSavePath = ThisWorkbook.Path & "\" & "Test.jpg" 'Change Ext as .bmp
returnValue = URLDownloadToFile(0, strUrl, strSavePath, 0, 0)
MsgBox IIf(returnValue = 0, "Succeed!", "Not succeed!")
End Sub
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.