hvis du tilføje en micrsoft inet control kan du benytte flg. kode til at download en fil med.
Function FileExists(sFile As String) As Boolean
Dim FSO As Object
Set FSO = CreateObject("Scripting.FileSystemObject")
FileExists = FSO.FileExists(sFile)
End Function
Public Sub bdownload(Url As String, Destination As String)
Dim think As String
think = 0
Dim sentdata() As Byte
If Inet1.StillExecuting = True Then Exit Sub
On Error GoTo 2
sentdata() = Inet1.OpenURL(Url, icByteArray)
For x = Len(Url) To 1 Step -1
If Left$(Right$(Url, x), 1) = "/" Then RealFile$ = Right$(Url, x - 1)
Next x
rf = Split(RealFile$, "?")
RealFile$ = rf(0)
gotFile$ = Destination + "\" + RealFile$
Close
If FileExists(gotFile$) Then
Kill gotFile$
End If
On Error GoTo 2
Open gotFile$ For Binary Access Write As #1
Put #1, , sentdata()
Close #1
2
End Sub
den kalder du bare med
bdownload "
www.google.com", "C:\"
-Thomas