Hi simi,
I tried Your code but it didn't work for both (2003 and 2k7)
Probable problem is because you tried to get a file from HTTPS (shouldn't you send login and password for that protocol ?)
I also tried my similar code and doesn't work for source address in 2003 and in 2007
Option Explicit
Const ERROR_SUCCESS As Long = 0
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 testit()
Dim flag1 As Boolean
flag1 = DownloadFile("https://myportal.com/ZZDR6.csv", "c:\test.csv")
If flag1 Then
MsgBox "It downloaded the file"
Else
MsgBox "It didn't get the file"
End If
End Sub
Function DownloadFile(s0 As String, s1 As String) As Boolean
DownloadFile = URLDownloadToFile(0, s0, s1, 0, 0) = ERROR_SUCCESS
End Function
Bookmarks