I am trying to download exe file from my server using Visal basic. Unfortunatly iam not able to download exe file. But at the same time i can able to download apart from EXE files.
In below i have given my Code:
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
Private Sub cmdMethod2_Click()
Dim retVal As Long
Dim theUrl As String
Dim savePath As String
Dim pathExist As Long
theUrl = "http://................/Noodle.exe"
If theUrl = "" Then Exit Sub
savePath = App.Path & "\noodle.exe"
If savePath = "" Then Exit Sub
retVal = URLDownloadToFile(0, theUrl, savePath, 0, 0)
If retVal = 0 Then
MsgBox "File was downloaded successfully!", vbExclamation, " Download Successful"
Else
MsgBox "There was a error downloading the file. Make sure that the url is valid and try again!", vbCritical, " Error"
End If
End Sub
if any one find a solution to solve the isseues please.