Private Sub get_files()
'copy files from website
' Requires references to Microsoft Shell Controls and Automation
Dim myFolderItem As Shell32.FolderItem
Dim myFolderItem2 As Shell32.FolderItem
Dim localFolder As Shell32.Folder
Dim myShell As New Shell
For Each myFolderItem In ftpList("yourftpserver/your_folder/" & Form!wooID, "username", "password") 'Each item could be a folder or a file
Debug.Print myFolderItem.name, myFolderItem.IsFolder ' just for fun to illustrate stuff we can do
If myFolderItem.IsFolder = True Then
For Each myFolderItem2 In ftpList("yourftpserver/your_folder/" & myFolderItem.name, "username", "password") 'Each item could be a folder or a file
If myFolderItem2.IsFolder = False Then
Set localFolder = myShell.NameSpace("C:\your_local_folder\") ' or wherever your local folder is
localFolder.CopyHere myFolderItem2 ' copy the required item
End If
Next
End If
Next
end sub
' Returns a FolderItems collection from the FTP server
Private Function ftpList(strFTPlocation As String, Optional strUser As String, Optional strPassword As String) As FolderItems
Dim myShell As New Shell
Dim strConnect As String
If strUser <> "" Then strConnect = strUser & ":" & strPassword & "@"
Set ftpList = myShell.NameSpace("FTP://" & strConnect & strFTPlocation).Items '("ftp://user:password@ftp.site.com")
End Function