SowmyaSwarga
New Member
- Joined
- Dec 9, 2020
- Messages
- 1
- Office Version
- 2016
- Platform
- Windows
I'm trying to access FTP using hostname, username & password. need to access the particular folders and copy the latest file (Based on created, as the filename may vary each time) to my local path. Copying the latest file is working using the below code. Could someone probably help me to append the code with an FTP login?
Sub test()
Dim myFile As String, Result As String
Const TargetFolder As String = "D:\Wolken\Pending Report\Files\"
Const myPath As String = "D:\Test\"
myFile = Dir(myPath & "*.csv")
Do While myFile <> ""
If myFile > Result Then Result = myFile
myFile = Dir
Loop
FileCopy myPath & Result, TargetFolder & Result
End Sub
Sub test()
Dim myFile As String, Result As String
Const TargetFolder As String = "D:\Wolken\Pending Report\Files\"
Const myPath As String = "D:\Test\"
myFile = Dir(myPath & "*.csv")
Do While myFile <> ""
If myFile > Result Then Result = myFile
myFile = Dir
Loop
FileCopy myPath & Result, TargetFolder & Result
End Sub