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
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
DownloadFile = URLDownloadToFile(0&, sURL, _
sLocalFile, 0&, 0&) = ERROR_SUCCESS
End
Function
Private
Sub
DownloadFile()
Dim
sourceUrl
As
String
Dim
targetFile
As
String
targetFile =
"F:\Test"
Call
DownloadFile(sourceUrl, targetFile)
End
Sub