0

I'm using VBA to open an Internet Explorer window, navigate and log into a webpage and download an Excel Spreadsheet. Every bit of the process works fine, but I can't find a way to automate the process of choosing the "save" option everytime I try to download something on IE.

Here's the code I've been using, found it here, I know I can set VBA to send Alt+S automatically, but it won't work when IE is not in focus and I just couldn't find a way on the web that works.

AppActivate "Internet Explorer"
Application.SendKeys "%{S}"

Is there another way to do it? Without Sending Keys? Or a working way to send keys?

I appreciate any help!

Observations: I'm using IE 11 and can't tinker with it's settings, because I'm not the administrator.

SamRosignoli
  • 29
  • 1
  • 2
  • 6
  • How is the download triggered? – Tim Williams Aug 29 '17 at 17:15
  • It clicks on an image with a specific id: `objIE.document.getElementById("formE:j_idt945").Click` And then it asks me if i want to open or save it. – SamRosignoli Aug 29 '17 at 17:20
  • It may be that there's an easier way to download the file, but with the relevant source from the page it's hard to know. If there's a URL in there which points directly to the download then `Workbooks.Open(theURL)` is easier to implement. – Tim Williams Aug 29 '17 at 17:23
  • Yeah I understand what you're saying, but I don't think it can be done :( `` I think it's calling a javascript function. – SamRosignoli Aug 29 '17 at 17:28
  • https://stackoverflow.com/questions/32145437/controlling-ie11-do-you-want-to-open-save-dialogue-window-buttons-in-vba has a Windows API-based approach. – Tim Williams Aug 29 '17 at 17:39

0 Answers0