SandeepKumar
New Member
- Joined
- Dec 15, 2014
- Messages
- 12
Hi All,
I want to download multiple files from FTP server.
I have the log in Credentials of FTP server . Below is the VBA I am using to download files .
VBA Code :
Sub Get_File_From_FTP()
'Variable Declarion Section
Dim FTP As Inet
'Assign Host URL, Source and Destination File path
HostURL = ThisWorkbook.Sheets(1).Cells(1, 1)
FileSource = ThisWorkbook.Sheets(1).Cells(1, 2)
FileDestination = ThisWorkbook.Sheets(1).Cells(2, 2)
'Create New instance of Object and Assign the Parameters
Set FTP = New Inet
With FTP
.URL = HostURL
.Protocol = icFTP
'Replace with your Login and Password Below. Many FTP servers allow Anonymous access with below credentials
.UserName = "My user Name"
.Password = "My Password"
.AccessType = icUseDefault
'Use "Get" to Download and "Put" Option to Upload File to FTP Server
.Execute .URL, "Get " & FileSource & " " & FileDestination
End With
Do While FTP.StillExecuting
DoEvents
Loop
'Status of FTP through Voice Message
Application.Speech.Speak "Process Completed;" & FTP.ResponseInfo
If FTP.ResponseCode = 0 Then
'SomeTime FTP steps will execute successfully, but file will not be there in Destination path
'Search for the file in the Path mentioned in this Message Box
MsgBox "File is Copied to :" & VBA.CurDir
End If
Set FTP = Nothing
End Sub
MSINET.OCX files are also imported in Project .
Please help , while executing the program Compilation error comes" Can't find Project Lib"
I want to download multiple files from FTP server.
I have the log in Credentials of FTP server . Below is the VBA I am using to download files .
VBA Code :
Sub Get_File_From_FTP()
'Variable Declarion Section
Dim FTP As Inet
'Assign Host URL, Source and Destination File path
HostURL = ThisWorkbook.Sheets(1).Cells(1, 1)
FileSource = ThisWorkbook.Sheets(1).Cells(1, 2)
FileDestination = ThisWorkbook.Sheets(1).Cells(2, 2)
'Create New instance of Object and Assign the Parameters
Set FTP = New Inet
With FTP
.URL = HostURL
.Protocol = icFTP
'Replace with your Login and Password Below. Many FTP servers allow Anonymous access with below credentials
.UserName = "My user Name"
.Password = "My Password"
.AccessType = icUseDefault
'Use "Get" to Download and "Put" Option to Upload File to FTP Server
.Execute .URL, "Get " & FileSource & " " & FileDestination
End With
Do While FTP.StillExecuting
DoEvents
Loop
'Status of FTP through Voice Message
Application.Speech.Speak "Process Completed;" & FTP.ResponseInfo
If FTP.ResponseCode = 0 Then
'SomeTime FTP steps will execute successfully, but file will not be there in Destination path
'Search for the file in the Path mentioned in this Message Box
MsgBox "File is Copied to :" & VBA.CurDir
End If
Set FTP = Nothing
End Sub
MSINET.OCX files are also imported in Project .
Please help , while executing the program Compilation error comes" Can't find Project Lib"