Lighthouse6
New Member
- Joined
- Jun 27, 2013
- Messages
- 11
Hi guys, I've been going around in circles for days trying to solve this problem.
I am trying to login to a site and download a file using an InternetExplorer object with VBA. 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?
Here is what I have tried:
1. URLDownloadToFile. This doesn't work because the file is not accessible without logging in.
2. Disabling the open/save prompt in Internet Explorer. Also no go. This prompt is designed as a security "feature" and is designed not to be disabled. Some people have mentioned that manually putting in registry keys could do the trick, but it has not worked for me. (Maybe I am not doing the right registry keys)?
3. Is there an download manager add in for Internet Explorer that disables the prompt? I have not found one yet.
4. Downgrading Internet Explorer from version 10 to version 7. (I'm using Windows 7, and I don't even know if it's compatible).
5. SendKeys ("%o") '(Alt + o). This should 'click' Open file. Why not use it? Because it's not reliable. The user sometimes switches the active window away. (Is there a way to "SendKeys" to a specific window?)
6. Repeating SendKeys if the file didn't open the first time.
7. Using WinHttpRequest instead of InternetExplorer. 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. I am pretty new at vba altogether and it took me a few weeks to get this far. 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). When using InternetExplorer I can watch what is happening.
8. iMacros. Theoretically, once the code enters the fields in the web site it can call iMacros to download the file. 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. For each one of hundreds of files!
Help! Thank you.
I am trying to login to a site and download a file using an InternetExplorer object with VBA. 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?
Here is what I have tried:
1. URLDownloadToFile. This doesn't work because the file is not accessible without logging in.
2. Disabling the open/save prompt in Internet Explorer. Also no go. This prompt is designed as a security "feature" and is designed not to be disabled. Some people have mentioned that manually putting in registry keys could do the trick, but it has not worked for me. (Maybe I am not doing the right registry keys)?
3. Is there an download manager add in for Internet Explorer that disables the prompt? I have not found one yet.
4. Downgrading Internet Explorer from version 10 to version 7. (I'm using Windows 7, and I don't even know if it's compatible).
5. SendKeys ("%o") '(Alt + o). This should 'click' Open file. Why not use it? Because it's not reliable. The user sometimes switches the active window away. (Is there a way to "SendKeys" to a specific window?)
6. Repeating SendKeys if the file didn't open the first time.
7. Using WinHttpRequest instead of InternetExplorer. 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. I am pretty new at vba altogether and it took me a few weeks to get this far. 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). When using InternetExplorer I can watch what is happening.
8. iMacros. Theoretically, once the code enters the fields in the web site it can call iMacros to download the file. 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. For each one of hundreds of files!
Help! Thank you.