Gruppe
Extern
Bereich
Internet
Thema
Binärdatei aus dem Internet downloaden und speichern
Problem
Aus dem Internet soll eine Binärdatei auf den Rechner geladen werden.
Lösung
Geben Sie den nachfolgenden Code in ein Standardmodul ein und weisen Sie ihn einer Schaltfläche zu.
StandardModule: Modul1
Private Declare Function URLDownloadToFile Lib "urlmon" _
Alias "URLDownloadToFileA" ( _
ByVal pCaller As Long, _
ByVal szURL$, _
ByVal szFileName$, _
ByVal dwReserved As Long, _
ByVal lpfnCB As Long) As Long
Sub Downl()
Dim lResult As Long
Dim sURL$, sLocalFile$
sURL = "http://www.excel-cd.de/downloads/xlBasics.zip"
sLocalFile = Application.DefaultFilePath & "xlbasics.zip"
lResult = URLDownloadToFile(0, sURL, sLocalFile, 0, 0)
End Sub