VBA - Saving an embedded PDF from IE

Regular7

New Member
Joined
Oct 2, 2018
Messages
4
Hi all,

I am trying to create a macro to open a site, then save the embedded pdf that is generated by the page. I understand how to open web pages etc. from an Excel Macro, but am stuck on finding a method to save an embedded pdf.

The embedded pdf has a button to 'save' and a button to 'open in new window'. The URL to the PDF is different each time.

Methods which won't work (I've alread tried):
  • Finding the element id of the 'open in a new window' button and doing .click (getting Run-time error 91).
  • CTRL+SHIFT+S won't work on IE to save it - can't use sendkeys to try and save this way.
  • Can't use sendkeys to 'tab' to the 'open in new window' button as opening stuff with Javascript 'locks' the screen. Can only click the button manually, or click into the page manually which then allows me to tab between buttons.
The only method I can think of is to somehow open the DOM explorer, search the text for the PDF url, then open that in a new IE tab - but I'm not sure this is even possible to do and it seems like a ridiculous solution.

Unfortunately I can't share the site I am looking at as it is a work intranet site.

Is there any way to do this/a workaround, or am I wasting my time on this project?

Thanks!
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,214,983
Messages
6,122,598
Members
449,089
Latest member
Motoracer88

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