75472
Goto Top

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?

Content-Key: 127974

Url: https://administrator.de/contentid/127974

Ausgedruckt am: 28.03.2024 um 10:03 Uhr

Mitglied: 75472
75472 27.10.2009 um 07:46:00 Uhr
Goto Top
Hy

Hab mir das Makro gerade angeschaut, die Lösung steht ja schon da... face-smile

'' 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


War nur nicht aktiv face-smile