
75472
27.10.2009
Per Makro Excel File an bestimmtes FTP Verzeichniss senden
Hy,
Ich habe ein Makro um eine Exceldatei (ORDER.CSV) direkt an einen FTP Server (Bsp. 10.10.10.10) zu senden.
Mein Problem ist nun, dass ich die Datei gerne in ein Unterverzeichniss namens "Bestellung" senden möchte.
Allerdings habe ich es nicht geschafft, das Makro so anzupassen dass es das File in den Ordner sendet!
Hier der Quellcode:
Sub ODSorderSEND()
Dim lngInet As Long, lngINetConn As Long
Dim ACKNOWLEDGE As Boolean
Dim timeict As String
Dim cust As String
lngInet = InternetOpen("MyFTPControl", 1, vbNullString, vbNullString, 0)
If lngInet = 0 Then
MsgBox "Could Not SetUp FTP Environment"
End If
lngINetConn = InternetConnect(lngInet, "10.10.10.10", 0, "FTP123", "123456", 1, 0, 0)
If lngINetConn = 0 Then
MsgBox "Could Not Connect To FTP Site"
End If
'' To Change to a particular directory in the FTP folder
'ACKNOWLEDGE = FtpSetCurrentDirectory(lngINetConn, "DIR NAME")
'If ACKNOWLEDGE = False Then
'MsgBox "Could not change to the directory"
'End If
timeict = Year(Now) & Month(Now) & Day(Now) & Hour(Now) & Minute(Now) & Second(Now)
cust = Range("B1")
ACKNOWLEDGE = FtpPutFile(lngINetConn, "Share\ORDER.csv", "ORDER." & cust & "_" & timeict, 2, 0)
If ACKNOWLEDGE = False Then
MsgBox "Could not transfer the file"
Else
MsgBox "ORDER CORRECTLY SENT", vbInformation
End If
If lngINetConn <> 0 Then InternetCloseHandle lngINetConn
If lngInet <> 0 Then InternetCloseHandle lngInet
End Sub
Kann mir jemand helfen?
Ich habe ein Makro um eine Exceldatei (ORDER.CSV) direkt an einen FTP Server (Bsp. 10.10.10.10) zu senden.
Mein Problem ist nun, dass ich die Datei gerne in ein Unterverzeichniss namens "Bestellung" senden möchte.
Allerdings habe ich es nicht geschafft, das Makro so anzupassen dass es das File in den Ordner sendet!
Hier der Quellcode:
Sub ODSorderSEND()
Dim lngInet As Long, lngINetConn As Long
Dim ACKNOWLEDGE As Boolean
Dim timeict As String
Dim cust As String
lngInet = InternetOpen("MyFTPControl", 1, vbNullString, vbNullString, 0)
If lngInet = 0 Then
MsgBox "Could Not SetUp FTP Environment"
End If
lngINetConn = InternetConnect(lngInet, "10.10.10.10", 0, "FTP123", "123456", 1, 0, 0)
If lngINetConn = 0 Then
MsgBox "Could Not Connect To FTP Site"
End If
'' To Change to a particular directory in the FTP folder
'ACKNOWLEDGE = FtpSetCurrentDirectory(lngINetConn, "DIR NAME")
'If ACKNOWLEDGE = False Then
'MsgBox "Could not change to the directory"
'End If
timeict = Year(Now) & Month(Now) & Day(Now) & Hour(Now) & Minute(Now) & Second(Now)
cust = Range("B1")
ACKNOWLEDGE = FtpPutFile(lngINetConn, "Share\ORDER.csv", "ORDER." & cust & "_" & timeict, 2, 0)
If ACKNOWLEDGE = False Then
MsgBox "Could not transfer the file"
Else
MsgBox "ORDER CORRECTLY SENT", vbInformation
End If
If lngINetConn <> 0 Then InternetCloseHandle lngINetConn
If lngInet <> 0 Then InternetCloseHandle lngInet
End Sub
Kann mir jemand helfen?
Bitte markiere auch die Kommentare, die zur Lösung des Beitrags beigetragen haben
Content-ID: 127974
Url: https://administrator.de/forum/per-makro-excel-file-an-bestimmtes-ftp-verzeichniss-senden-127974.html
Ausgedruckt am: 29.04.2025 um 02:04 Uhr
1 Kommentar