1

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.

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

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.

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

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.

Any ideas would be greatly appreciated! Thanks.

CKE
  • 1,533
  • 19
  • 18
  • 29
  • I prefer to download with the imported URLDownloadToFile but beware about properly compiler #def'ing 64bit vs 32 bit on 64 bit. –  Jul 02 '18 at 05: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 02 '18 at 06: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 02 '18 at 17:57
  • Recursively look thru all folders from `Environ("USERPROFILE") & "\AppData\Local\Microsoft\Windows\Temporary Internet Files\Low\Content.IE5"` should get you going, and perhaps add condition to only consider files that are 1 or 2 days old. – PatricK Jul 02 '18 at 22:47
  • @ PatricK That did the trick! I used the code from the top answer [here](https://stackoverflow.com/questions/22645347/loop-through-all-subfolders-using-vba) to do a recursive search. – ausernottaken Jul 04 '18 at 19:34

0 Answers0