Saving a PDF after it is opened via Excel hyperlink

J Harper

New Member
Joined
Jun 3, 2021
Messages
17
Office Version
  1. 365
Platform
  1. Windows
How can I automate the saving of a PDF file after it is opened via an Excel hyperlink? I open the pdf file via hyperlink and then save to a specific subdirectory after naming the file. I need to do this 100s of times within each Excel.
 
I changed to the suggested code. I did not get an error, BUT not files were copied. Examples of the hyperlinks are listed in the attached HYPERLINKS STRING file.

Thank you for your help!
 
Upvote 0

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
The hyperlink is grabbing a file/image that is presented in the Document Viewer.
In that case the code can't download the file (what is the Document Viewer?) You need to change the hyperlinks to direct download links.

I tried it with a Google Drive shareable link and the code appeared to work, but downloaded a 'PDF' file which couldn't be opened. When I changed the shareable link to a direct download link the code downloaded a valid PDF file to the specified folder.
 
Upvote 0
Tne macro now creates the PDFs without giving and error, BUT when I try to open the files I get and error " We cannot open this file" as seen in the attachment.
 

Attachments

  • Error When Opening File.jpg
    Error When Opening File.jpg
    54.3 KB · Views: 5
Upvote 0
Tne macro now creates the PDFs without giving and error, BUT when I try to open the files I get and error " We cannot open this file" as seen in the attachment.
Which is basically the same error that I got with a shareable link. With a correct direct download link pasted into the address bar of your browser it should open a file open/save dialogue allowing you to download the file and the same link should work with the macro.
 
Upvote 0
So what is the fix? If the fix being acquired is a data image being shared, is there a fix?

The other approach would to be open the file and then save, BUT your approach is much better.

Any ideas?
 
Upvote 0

Forum statistics

Threads
1,223,997
Messages
6,175,874
Members
452,679
Latest member
darryl47nopra

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