VBA for downloading multiple PDF files from different hyperlinks

Dukysan

New Member
Joined
Apr 17, 2019
Messages
1
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.

Code:
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 !
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Forum statistics

Threads
1,223,701
Messages
6,173,920
Members
452,539
Latest member
deeme

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top