I posted an earlier thread, asking for help creating a macro that would create folders based on a value of a cell. This worked flawlessly, as seen below.
What I need to do now, is download a large number of files that have hyperlinks in the rows from the folder list.
Example:
Column A (Location A) - Created a folder list using VBA below (can delete folders and start over if needed)
Column C (https://hyperlink.com) - need to click and download the photo from the link, and save to the folder that was just created from column A
Column H (https://hyperlink.com) - Not all rows will have this optional link to click, but if present, need to click-download-and save to folder.
Will need to loop until completed for all rows.
Any help is greatly appreciated.
Public Function IsFolderExists(txt As String) As Boolean
'returns true if the folder exists already, false if it does not.
IsFolderExists = CreateObject("Scripting.FileSystemObject").FolderExists(txt)
End Function
Sub create_folders()
'takes a folder name from the sheet in column A, and creates folder
Dim myFile As String
Dim myPath As String 'folder to test
Dim myPaths 'to check each folder in the destination path
Dim i As Long, j As Integer
Dim ws As Worksheet 'sheet with data
Dim lr As Long 'last row with data
Set ws = Worksheets("Sheet1") 'change sheet name as needed
lr = ws.Range("A" & Rows.Count).End(xlUp).Row 'last row with data in col A
For i = 1 To lr
myPath = "C:\Signage\" & ws.Range("A" & i).Value
If Not IsFolderExists(myPath) Then
CreateObject("Scripting.FileSystemObject").CreateFolder myPath
End If
Next i
End Sub
Bookmarks