# VBA for downloading multiple PDF files from different hyperlinks



## Dukysan (Apr 17, 2019)

Hi guys, I need some help with this task. I have to create a function that will allow me to download multiple files when I press a button.

The files are on a web pages and they are in PDF format. The link to each file is behind a hyperlink. ( and it ends with .pdf ex: http://website.com/file.pdf)

The activity should be like this: the user selects the cells, presses the button "save documents" and the vba should recognize the selection of multiple cells, look into the hyperlinks, download the PDF files, and save them in a specific folder (path). 

I should probably mention as well that I am new to VBA. I checked some tutorials and posts on the forum but I didn't seem to come across a solution.

What I did so far:

I have the hyperlinks set up with the links to the PDFs and I have the button.

 I found the code for creating a folder on desktop. 


```
Private Sub CreateFolder()    Dim fdObj As Object
    Application.ScreenUpdating = False
    Set fdObj = CreateObject("Scripting.FileSystemObject")
    If fdObj.FolderExists("C:\Users\" & Environ("UserName") & "\Desktop\Temp folder") Then
        MsgBox "Found it.", vbInformation, "Excel"
    Else
        fdObj.CreateFolder ("C:\Users\" & Environ("UserName") & "\Desktop\Temp folder")
        MsgBox "It has been created.", vbInformation, "Excel"
    End If
    Application.ScreenUpdating = True
    


End Sub
```

The website doesn't require authentication.

Thanks a lot !


----------

