(To get to it, press F2 from within the Excel code editor). The object browser in Excel was (and is) very useful. The right tools make the job much easier.Ī. Thanks to this article Using VBA to Access the 'Net by Tushar Mehta for pushing me in the right direction. It was pretty intimidating at first but with the right information it became a lot easier. Next, I tried using WinHttpRequest with the encouragement of John and Kyle. My learning process of theWinHttpRequest object: This worked for me but is not very elegant and takes a few seconds to execute (you need to pause at each step long enough to make sure that the dialog box is really open and registering the interaction.) Instead I finally switched to %s (alt+s for "Save File") and had VBA code to open the file as soon as it finished downloading. For some reason, although sending "%o" it made the dialog box go away in IE9 and in IE10 many times Excel did not open. (In my case I struggled with sendkeys.exe trying to send "%o" (Alt+o for "Open File") to Internet Explorer to open the download.xls file in excel.
The way Windows is designed it's not possible to reliably send keystrokes reliably to another program. But sending keystrokes to a program is just not very reliable. First the good news: It's a great little program for what it does (thanks John) simple and elegant.
Thank you John and Kyle for your help and encouragement.Īfter verifying that Sendkeys.exe was not infected, by running it through an online virus scanner that runs dozens of different antivirus software scanners on it, and seeing that the link was suggested elsewhere as well, I tried Sendkeys.exe. The problem with iMacros is that it takes time to load and close because it would have to load FireFox with the iMacro, then load the Web site and then close Firefox. Theoretically, once the code enters the fields in the web site it can call iMacros to download the file. When using InternetExplorer I can watch what is happening.Ĩ. Besides, debugging WinHttpRequest would seem to be much more difficult because I cannot see what's happening (correct me if I'm wrong on that point). I am pretty new at vba altogether and it took me a few weeks to get this far.
This should probably work, but it seems like it is a lot of work to learn how to use the WinHttpRequest and to rewrite all of my code. Using WinHttpRequest instead of InternetExplorer. Repeating SendKeys if the file didn't open the first time.ħ. (Is there a way to "SendKeys" to a specific window?)Ħ. The user sometimes switches the active window away. Why not use it? Because it's not reliable. (I'm using Windows 7, and I don't even know if it's compatible).ĥ. Downgrading Internet Explorer from version 10 to version 7. Is there an download manager add in for Internet Explorer that disables the prompt? I have not found one yet.Ĥ. (Maybe I am not doing the right registry keys)?ģ. Some people have mentioned that manually putting in registry keys could do the trick, but it has not worked for me. This prompt is designed as a security "feature" and is designed not to be disabled.
Disabling the open/save prompt in Internet Explorer. This doesn't work because the file is not accessible without logging in.Ģ. The problem is that once the code clicks on the hyperlink I get a prompt from Internet Explorer (version 10 in my case): "Do you want to open or save "file.xls"? What do I do now?ġ. I am trying to login to a site and download a file using an InternetExplorer object with VBA. Hi guys, I've been going around in circles for days trying to solve this problem.