Hyperlinks and Save

Dan88

Active Member
Joined
Feb 14, 2008
Messages
278
Office Version
  1. 365
Platform
  1. Windows
Good Day. I have a sheet containing hyperlinks in column A. I would appreciate if someone can share a vba that can open each link and save into a specified directory. Ideally it won't open the link when running the vba and just save the file. It's 3800 links and opening each link I fear may crash.

I've searched forums but nothing seems to match what I need it to do.

Thanks
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
You can use the URLDownloadTofile API to download a file. This is the declaration:

VBA Code:
    #If VBA7 Then
        Private Declare PtrSafe Function URLDownloadToFile Lib "urlmon" _
                Alias "URLDownloadToFileA" (ByVal pCaller As LongPtr, _
                                            ByVal szURL As String, ByVal szFileName As String, _
                                            ByVal dwReserved As LongPtr, ByVal lpfnCB As LongPtr) As Long
    #Else
        Private Declare Function URLDownloadToFile Lib "urlmon" _
                                                   Alias "URLDownloadToFileA" (ByVal pCaller As Long, _
                                                                               ByVal szURL As String, ByVal szFileName As String, _
                                                                               ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
    #End If

And here is how to use it:
VBA Code:
URLDownloadToFile 0, "RemoteFileName", "LocalFileName", 0, 0
 
Upvote 0
Thanks for your attention .

Apologies for the trivial question,
How do I put this into the module?
As is?
 
Upvote 0
The top part goes at the top of the module, before any sub or function. The bottom one should go in a loop through the cells with links
 
Upvote 0

Forum statistics

Threads
1,226,453
Messages
6,191,136
Members
453,642
Latest member
jefals

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