IESaveFile is related to IEShowSaveFileDialog which assumes that the users is making a choice. In may case I want to be fully automated with no user intervention.
Main Topics
Browse All TopicsI'm trying to automate a File download dialog from a web site, using IE automation on VBA.
So far I've succeeded in getting the handle on the dialog window and the control (save button). But i can't click on it, although I've tried (as you can see in the code) several alternatives. The only thing I've get is that the focus shifts from the Cancel to the Save button, but is not properly clicked so I don't get the save as dialog as i get doing manually.
I guess I'm missing something gross here or else I'm being blocked by some kind of security settings (I'm using Vista and IE8)
Thankyou
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
So if the user isn't making a choice what is prompting the save dialog? I guess my question is do you have the (Link) to the file if you do than it can be fully automated. If the user is clicking a link on an explorer page there is no way to fully automate this unless you can catch the click event of a link and supress the dialog and fire off your own download routine.
Hi there
I do not have the link to the file and I do not want the user to do anything. The web I'm automating is that of a bank. Of course they do not have static links to a specific file. The Excel file is made by order by means of a Java script that makes it on-line and automatically prompsts the file download dialog. I call this Java Script in my automation program. So there is no link and there is no user (as the whole process is fully automated). So far i'm dealing with the File dowload as well as the Save as dialog by means of sendKeys, whichjusually works fine, but sometimes does not. What I am traying to do is to deal with both dialogs in a more controlled fashion (no more sendkeys!!!).
Thank you anyway
Hi Paul:
If you read my last comment you will see that there is no URL. There is not link to an specific file. The dowload dialog is prompted by a Java script, so there is no way I could use the URLDownloadToFile function as you suggest.
I cannot fully automate the first dialog (Download file) but I have no problems with the second one (Save as), using sendmessage and other USER 32 API calls.
Thank you anyway
I have been notified about this question and started to look into the problem in depth. I found out from trial and error that this IE save dialog does some additional checks before it works.
I was testing this using BM_CLICK obviously this didn't work by iteself. The reason is because the dialog is doing an additional check before it will accept the input.
The IE dialog checks that the actual cursor is over the button. If it's not over the button it ignores the message.
What does this mean? Well this is what the dialog is doing from my understanding.
First it calls GetCursorPos , then it calls WindowFromPoint. It then checks that the HWND = SaveButtonHWND. If they match it will accept the input.
I confirmed this by simply adding the BM_CLICK inside a timer and place my cursor over the (Save) button. The result was that it worked which lead to the conclusion of how the dialog is working internally.
I was wrong here it appeared that this was how the dialog was reacting but when I did some more tests I found out this is not true. If I place a small sleep in between the call it seems to work. However without the sleep call it fails every time. Now sure why it acts this way. I thought it had to do with the cursor position but it doesn't.
The following works for me :)
Hi egl1044:
I just follwed your idea aout the possition of the cursor and I managed to click the button.
Find attached the code snipped with the whole process: "download file" and "save as"
he web I'm automating is in Spanish, so that "Descarga de archivos" means "File download", "Guardar" is save, and so on...
At least for this web your idea that I accepted as a solution, worked as a charm
Thank you
Business Accounts
Answer for Membership
by: egl1044Posted on 2009-08-25 at 07:23:03ID: 25177892
Internet Explorer 7 + ::: Windows Vista + en-us/libr ary/ms5373 17(VS.85). aspx
http://msdn.microsoft.com/
IESaveFile Function
IEShowSaveFileDialog Function