Downloading file from web

Hi,

I am trying to download an image from the web using VBA code like:


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

Sub DownloadSingleFile()

FileURL = "">upload.wikimedia.org/.../Mercedes_V6_DTM_Rennmotor_1996.jpg"

DestinationFile = "C:\my files\engine.jpg"
If URLDownloadToFile(0, FileURL, DestinationFile, 0, 0) = 0 Then
Debug.Print "File downloaded"
Else
Debug.Print "File download not downloaded"
End If
End Sub

When I run this code in Excel, it downloads the file, but same code does not download file in CorelDraw.  What could be possibly wrong? 

Thanks in advance for your help.

Kind Regards.

Parents Reply Children
No Data