ich habe eine Code mit dem man eine Datei via FTP auf eine Server übertragen kann. Nach dem übertragen bekomme ich jedoch folgende Meldung.
Kann mir da jemand weiterhelfen?
Tobias
Function InternetCloseHandle Lib "wininet.dll" (ByVal hInet As Long) As Integer
Private Declare
Function InternetConnect Lib "wininet.dll" Alias "InternetConnectA" (ByVal hInternetSession As Long, ByVal sServerName As String, ByVal nServerPort As Integer, ByVal sUserName As String, ByVal sPassword As String, ByVal lService As Long, ByVal lFlags As Long, ByVal lContext As Long) As Long
Private Declare
Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" (ByVal sAgent As String, ByVal lAccessType As Long, ByVal sProxyName As String, ByVal sProxyBypass As String, ByVal lFlags As Long) As Long
Private Declare
Function FtpSetCurrentDirectory Lib "wininet.dll" Alias "FtpSetCurrentDirectoryA" (ByVal hFtpSession As Long, ByVal lpszDirectory As String) As Boolean
Private Declare
Function FtpGetCurrentDirectory Lib "wininet.dll" Alias "FtpGetCurrentDirectoryA" (ByVal hFtpSession As Long, ByVal lpszCurrentDirectory As String, lpdwCurrentDirectory As Long) As Long
Private Declare
Function FtpCreateDirectory Lib "wininet.dll" Alias "FtpCreateDirectoryA" (ByVal hFtpSession As Long, ByVal lpszDirectory As String) As Boolean
Private Declare
Function FtpRemoveDirectory Lib "wininet.dll" Alias "FtpRemoveDirectoryA" (ByVal hFtpSession As Long, ByVal lpszDirectory As String) As Boolean
Private Declare
Function FtpDeleteFile Lib "wininet.dll" Alias "FtpDeleteFileA" (ByVal hFtpSession As Long, ByVal lpszFileName As String) As Boolean
Private Declare
Function FtpRenameFile Lib "wininet.dll" Alias "FtpRenameFileA" (ByVal hFtpSession As Long, ByVal lpszExisting As String, ByVal lpszNew As String) As Boolean
Private Declare
Function FtpGetFile Lib "wininet.dll" Alias "FtpGetFileA" (ByVal hConnect As Long, ByVal lpszRemoteFile As String, ByVal lpszNewFile As String, ByVal fFailIfExists As Long, ByVal dwFlagsAndAttributes As Long, ByVal dwFlags As Long, ByRef dwContext As Long) As Boolean
Private Declare
Function FtpPutFile Lib "wininet.dll" Alias "FtpPutFileA" (ByVal hConnect As Long, ByVal lpszLocalFile As String, ByVal lpszNewRemoteFile As String, ByVal dwFlags As Long, ByVal dwContext As Long) As Boolean
Private Declare
Function InternetGetLastResponseInfo Lib "wininet.dll" Alias "InternetGetLastResponseInfoA" (lpdwError As Long, ByVal lpszBuffer As String, lpdwBufferLength As Long) As Boolean
Private Declare
Function FtpFindFirstFile Lib "wininet.dll" Alias "FtpFindFirstFileA" (ByVal hFtpSession As Long, ByVal lpszSearchFile As String, lpFindFileData As WIN32_FIND_DATA, ByVal dwFlags As Long, ByVal dwContent As Long) As Long
Private Declare
Function InternetFindNextFile Lib "wininet.dll" Alias "InternetFindNextFileA" (ByVal hFind As Long, lpvFindData As WIN32_FIND_DATA) As Long
Const PassiveConnection As Boolean = True
Public updown$
Sub Form_Load()
Dim hConnection As Long, hOpen As Long, sOrgPath As String
hOpen = InternetOpen("API-Guide sample program", INTERNET_OPEN_TYPE_PRECONFIG, vbNullString, vbNullString, 0)
hConnection = InternetConnect(hOpen, _
"www.server.de", _
INTERNET_DEFAULT_FTP_PORT, _
"Benutzer", _
"passwort", _
INTERNET_SERVICE_FTP, _
IIf(PassiveConnection, _
INTERNET_FLAG_PASSIVE, 0), 0)
sOrgPath = VBA.String(MAX_PATH, 0)
FtpGetCurrentDirectory hConnection, sOrgPath, Len(sOrgPath)
FtpSetCurrentDirectory hConnection, _
"/verzeichnis/"
If updown = "up" Then
FtpPutFile hConnection, _
Worksheets("Tabelle1").[cb2], Worksheets("Tabelle1").[cb3], _
FTP_TRANSFER_TYPE_UNKNOWN, 0
End If
EnumFiles hConnection
If updown = "do" Then
FtpGetFile hConnection, _
Worksheets("Tabelle1").[cb3], Worksheets("Tabelle1").[cb2], _
False, 0, FTP_TRANSFER_TYPE_UNKNOWN, 0
End If
InternetCloseHandle hConnection
InternetCloseHandle hOpen
MsgBox "Upload durchgeführt"
End Sub
Public
Sub EnumFiles(hConnection As Long)
Dim pData As WIN32_FIND_DATA, hFind As Long, lRet As Long
AutoRedraw = True
pData.cFileName = String(MAX_PATH, 0)
hFind = FtpFindFirstFile(hConnection, "*.*", pData, 0, 0)
If hFind = 0 Then Exit Sub
Do
pData.cFileName = String(MAX_PATH, 0)
lRet = InternetFindNextFile(hFind, pData)
If lRet = 0 Then Exit Do
Loop
InternetCloseHandle hFind
End Sub
Sub ShowError()
Dim lErr As Long, sErr As String, lenBuf As Long
InternetGetLastResponseInfo lErr, sErr, lenBuf
sErr = String(lenBuf, 0)
InternetGetLastResponseInfo lErr, sErr, lenBuf
MsgBox "Error " + CStr(lErr) + ": " + sErr, vbOKOnly + vbCritical
End Sub