Hello Sirs,

I would like to ask for help to complete the following macro, many thanks in advance for any idea that you decide to share!

Macro Objetive: Download from a website a XLS file with production data. To get the file I have to fill a website form with user/pass and dates from/to, then appear a button to export XLS file.
I woul like to automatize this process just with two cells in an excell and a macro button.

My current macro fill the website form but it is blocked when it should get XLS file from website button.

Current MAcro:

Sub downloadproduction()

On Error Resume Next
MkDir "C:\Production"
On Error GoTo 0
Application.DisplayAlerts = False


Set IE = CreateObject("InternetExplorer.Application")

IE.Visible = False
IE.Navigate ("http://hispanagar.cascoantiguo.com/aqua/")
Do
If IE.READYSTATE = 4 Then
IE.Visible = False
Exit Do
Else
DoEvents
End If
Loop
IE.document.Forms(0).all("user").Value = "user"
IE.document.Forms(0).all("password").Value = "pass"
IE.document.Forms(0).submit

With IE
.Visible = False
.Navigate "http://hispanagar.cascoantiguo.com/aqua/consultas/Lotesproducidosexcel.asp"
Do
If IE.READYSTATE = 4 Then
IE.Visible = False
Exit Do
Else
DoEvents
End If
Loop
IE.document.Forms(0).all("dfrom").Value = "02/07/2015"
IE.document.Forms(0).all("dto").Value = "16/07/2015"
IE.document.Forms(0).submit



Workbooks.Open ("http://hispanagar.cascoantiguo.com/aqua/consultas/Lotesproducidosexcel.asp")
`

Here! The 1004 error occurs, I have tried with Winhttp code but I don't get it to work.

Any idea to complete the code?

thanks a lot