VBA IE 10 Automation - Automatically Save PDFs

Multi tool use
Multi tool use


VBA IE 10 Automation - Automatically Save PDFs



I'm trying to automate the process of saving PDF invoices for bookkeeping purposes. The method suggested here does not work because a login is required to access the invoices.


PDF



I currently have a macro that navigates to the page, logs in and opens the links to each invoice. The URL scheme for these invoices is .../account/invoice/?invoice_number=XXXXXX. Navigating to each of these URL brings up the files in the


URL


.../account/invoice/?invoice_number=XXXXXX


URL



View Downloads



window. I would like the files to automatically save, but according to this page, the Always ask before opening this type of file option was depreciated from IE 10 and 11 due to security reasons.


Always ask before opening this type of file



I attempted to automatically click Save using this method, but the code here seems to be for a different version of IE.


Save



The line:


hWnd = FindWindow("#32770", "File Download")



was modified to:


hwnd = FindWindow("#32770", "View Downloads - Windows Internet Explorer")



This successfully captures the download window, but it fails to find the &Save button for me to click. My guess would be that it's because there are multiple save buttons.


&Save



Any ideas would be greatly appreciated! Thanks.





I prefer to download with the imported URLDownloadToFile but beware about properly compiler #def'ing 64bit vs 32 bit on 64 bit.
– Jeeped
Jul 2 at 5:33





Install Acrobat Reader or similar and have it setup to open PDF links inside the browser. Then search thru the IE cache file.
– PatricK
Jul 2 at 6:13





@PatricK This seems to be the way to go. I can see the files appear in the temporary files directory. However, FileSystemObject only sees counters.dat and desktop.ini in the temporary internet files folder.
– ausernottaken
Jul 2 at 17:57





Recursively look thru all folders from Environ("USERPROFILE") & "AppDataLocalMicrosoftWindowsTemporary Internet FilesLowContent.IE5" should get you going, and perhaps add condition to only consider files that are 1 or 2 days old.
– PatricK
Jul 2 at 22:47


Environ("USERPROFILE") & "AppDataLocalMicrosoftWindowsTemporary Internet FilesLowContent.IE5"





@ PatricK That did the trick! I used the code from the top answer here to do a recursive search.
– ausernottaken
Jul 4 at 19:34









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

EDKepK,ngy P
OyT,Fal,iFxtpPC832sCBOnNiX,kq,DV EQAfb Avg,UiOYx9K WIOYhH7

Popular posts from this blog

Rothschild family

Cinema of Italy