I have this macro, which I want to download all the files given by the hyperlinks in column a. The problem is that the line of code with the Choose function isn't working. Is there a way to enter an array as the value argument in Choose or another function that will let me do what Choose tries to do?
Thanks!
Thanks!
Code:
Sub DownloadFiles()
' Downloads files given by any hyperlinks in Column A.
Const strPath As String = "G:\DownloadData\"
Dim strFile As String, lnum As Long
Dim rng As Range
Set rng = Range("A1:A" & Cells(Rows.Count, "A").End(xlUp).Row)
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For lnum = 1 To rng.Count
strFile = Choose(lnum, rng)
ThisWorkbook.FollowHyperlink strFile
With ActiveWorkbook
.SaveAs strPath & strFile
.Close
End With
Next lnum
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub