dowenloading large files with Inet
ok guys... this is a sub i created form a code i collected from somewhere.... but the thing is.. i cant.. donwload large files with it.. how do i correct this problem?
*******************************************
Private Sub Download(strURL As String)
Dim b() As Byte
Dim intCount As Integer
Dim strData As String
Inet.Cancel ' Stops any current operations
b() = Inet.OpenURL(strURL, icByteArray)
For intCount = 0 To UBound(b) - 1
strData = strData & Chr(b(intCount))
Next intCount
Open App.Path & NextFile For Output As #1
Print #1, strData
Close #1
MsgBox "d"
End Sub
Re: dowenloading large files with Inet
Quote:
Originally posted by deane034
ok guys... this is a sub i created form a code i collected from somewhere.... but the thing is.. i cant.. donwload large files with it.. how do i correct this problem?
*******************************************
Private Sub Download(strURL As String)
Dim b() As Byte
Dim intCount As Integer
Dim strData As String
Inet.Cancel ' Stops any current operations
b() = Inet.OpenURL(strURL, icByteArray)
For intCount = 0 To UBound(b) - 1
strData = strData & Chr(b(intCount))
Next intCount
Open App.Path & NextFile For Output As #1
Print #1, strData
Close #1
MsgBox "d"
End Sub
There is a direct API to download files from Net if you know the URL of the file. In your case i think you know the url in advance.
I think it is DoFileDownload API defined in shdocvw.dll
Declare Function DoFileDownload Lib "shdocvw.dll" (ByVal lpszFile As String) As Long
Just pass the file Url to it and it will do the trick for you.