Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
512to516
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
512to516
512to516
Aktuelles Verzeichnis
Verzeichnis Index
Verzeichnis Index
Übersicht Verzeichnisse
Inhaltsverzeichnis

Fehlermeldung FTP

Fehlermeldung FTP
04.11.2004 21:15:06
Tibias
Hi,
ich habe eine Code mit dem man eine Datei via FTP auf eine Server übertragen kann. Nach dem übertragen bekomme ich jedoch folgende Meldung.
Userbild
Kann mir da jemand weiterhelfen?
Tobias

6
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Fehlermeldung FTP
Ulf
Das ist ein VB- Code, nicht VBA. Autoredraw gibts bei userforms nicht.
Ulf
AW: Fehlermeldung FTP
04.11.2004 21:26:28
Tobias
Hallo Ulf,
der Code läuft ja auch nicht im einem UserForm, er wird nur von dort gestartet.
Was muß ich denn Deiner Meinung nach machen, damit der Code läuft? ihn als Makro laufen lassen?
Tobias
AW: Fehlermeldung FTP
Ulf
Trotzdem gibts den Befehl in VBA nicht.
Da müßte man schon mal den gesamten Code sehen.
Ulf
AW: Fehlermeldung FTP
04.11.2004 21:35:02
Tobias
Hier der Code:
nur das kuriose ist, das der Code auf meinem Rechner läuft und auf meinem Laptop nicht (beide gleiches OS und gleiche Excel Version)
Const FTP_TRANSFER_TYPE_UNKNOWN = &H0
Const FTP_TRANSFER_TYPE_ASCII = &H1
Const FTP_TRANSFER_TYPE_BINARY = &H2
Const INTERNET_DEFAULT_FTP_PORT = 21
Const INTERNET_SERVICE_FTP = 1
Const INTERNET_FLAG_PASSIVE = &H8000000
Const INTERNET_OPEN_TYPE_PRECONFIG = 0
Const INTERNET_OPEN_TYPE_DIRECT = 1
Const INTERNET_OPEN_TYPE_PROXY = 2
Const INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY = 4
Const MAX_PATH = 260
Private Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type
Private Type WIN32_FIND_DATA
dwFileAttributes As Long
ftCreationTime As FILETIME
ftLastAccessTime As FILETIME
ftLastWriteTime As FILETIME
nFileSizeHigh As Long
nFileSizeLow As Long
dwReserved0 As Long
dwReserved1 As Long
cFileName As String * MAX_PATH
cAlternate As String * 14
End Type
Private Declare

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

Anzeige
AW: Fehlermeldung FTP
Ulf
Lass einfach die zeile weg, dann läuft es zumindest ohne Fehler.
Ulf
AW: Fehlermeldung FTP
04.11.2004 22:05:58
Tobias
werde ich mal ausprobieren.
danke schonmal
Tobias

Links zu Excel-Dialogen

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige