Log in

View Full Version : [SLEEPER:] Can someone help me in this scenario to download files to multiple folders.



Satish Raju
04-21-2020, 06:30 PM
Hi team, can someone help me in this scenario to download files to multiple folders.
Like in the below code how do i change pth for every specific file to specific folder.
Ex: i want to move few files to "OLD" folder, and some files to "NEW" folder some of them to "MODERN" folder.. how can i loop the path as well. Thanks



Sub DownloadFile()
pth = "C:\VBAX"
For Each link In ActiveSheet.Hyperlinks
fname = Split(link.Address, "/")(UBound(Split(link.Address, "/")))
filename = pth & fname
URLDownloadToFile 0, link.Address, filename, 0, 0
Next link
End Sub