Downloading PDF from a website. Excel 2013 Win7.

Excelerate my work

New Member
Joined
Jun 30, 2015
Messages
5
Hi guys, like the title says I am trying to download a PDF from a website. Here's the situation. The website with the PDF (is a SharePoint site, so I do not have access at home) requires you login and then enter the month/year from a drop down box. Once the month/year is selected, you click a button to create report. The PDF is opened in the same page. There is a hyperlink that lets you download the PDF but when it is clicked, IE asks if you would like to open, save, or cancel. At the moment I have the marco successfully open IE, login to the page, and creates the desired report I can also have the macro click the link, but this is where I get stuck. I cannot figure out how to make the macro save the PDF onto the desktop. I am not sure if it helps, but the website ends .aspx.

Also, if I physically right click the hyperlink, I can "save target as" and asks what to name the file, is there a way this could be made automated?

Any help would be greatly appreciated.

Thanks,

Tyler
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Quick update: I have gotten it to work but it is not very...quick...I have macro open the PDF and sendkeys "^+s" Sendkeys "~". Is there a faster way to do that? if I select to save each month, it opens 7 pdfs and does that for each one. It works but it is slow.
 
Upvote 0
Another update: Still using the sendkey method, it is slow but works. URLdownloadtoFile still not working..I will get the code up soon, it seems it will not let me declare the function.
 
Upvote 0
Update! I've got URLDownloadToFile to work but when the PDF opens and is saved, it isn't saving correctly. The file on the desktop, when opened, says it is a corrupted file. Any ideas?
 
Upvote 0

Forum statistics

Threads
1,215,987
Messages
6,128,122
Members
449,424
Latest member
zephyrunimpressively

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