Guten Abend,
ich möchte gern eine Datei Downloaden und sie im Ziel Ordner abspeichern.
Die URL ist geschütz mit Username und password leider finde ich im Netz kein VBA beispiel
mit Passwort.
Vllt könnte mit jemand dabei helfen oder einen Denkanstoß geben.
Beste Grüße
Klaus
Option Explicit
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Originalcode - hier angepasst - von: Randy Birch,
' Copyright ©1996-2002 VBnet, All Rights Reserved.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
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 Const ERROR_SUCCESS As Long = 0
Public Function DownloadFile(ByVal sURL As String, _
ByVal sLocalFile As String) As Boolean
Dim lngRetVal As Long
'if the API returns ERROR_SUCCESS (0),
'return True from the function
DownloadFile = URLDownloadToFile(0&, sURL, _
sLocalFile, 0&, 0&) = ERROR_SUCCESS
End Function
Private Sub DownloadFile()
Dim sourceUrl As String
Dim targetFile As String
sourceUrl = "http://diedatei.csv"
targetFile = "F:\Test"
Call DownloadFile(sourceUrl, targetFile)
End Sub