How to get a file from a web page

Aug 21, 2017
Reaction score
Hi to all Community

I am new here.

I am making a macro which have to open one excel file store in Redmine.

I did get some codes from forums and I got the web page, but despite that I put URL, User and Password, when I executed the macro I got the following:

The web page is open
Web page show me the dialog form in order to enter user and password
Macro fail when is making a loop asking for IE.readyState <> 4
Its appear the message related to "only shows safety data, what is the risk"

I would appreciate your help

Best regards and thanks in advance


Aug 21, 2017
Reaction score
Dear All Community

I think that I was not clear in my speech before. I will add more information

I built a code from differents codes gathered inside internet. The problem is that I need to go to button "Open" in order to open the Excel file that I must to open.

The attached VBA code run up to put the user and password ( work ok ) , get the file but Internet Explorer wait until manually I click over the Open Button.

The idea is go ( with VBA code ) to the button Open and then click to open the excel file

The code is the following:

Sub exito()

Set IE = CreateObject("InternetExplorer.application")

IE.Visible = True

IE.navigate ("")

If IE.readyState = 4 Then
IE.Visible = True
Exit Do
End If


IE.document.forms(0).all("username").Value = "(e-mail address removed)"
IE.document.forms(0).all("password").Value = "ipfisanott2017*"

' up to here the code run very well

' in the next sentences I am not able to click over Open file button

For Each itm In IE.document.all
If itm = "[object HTMLInputElement]" Then ' I think that Object HTMLXXXXXElement" should be other related to cursor movement
n = n + 1
If n = 3 Then

Application.SendKeys "{TAB}", True

Application.SendKeys "~", True
Exit For
End If
End If

End Sub

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question