- Joined
- Aug 21, 2017
- Messages
- 4
- Reaction score
- 0
Dear All Community
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 ("https://www.proyectos.cl/attachments/download/28170/DivSeguridad2020170714.xlsx")
Do
If IE.readyState = 4 Then
IE.Visible = True
Exit Do
Else
DoEvents
End If
Loop
IE.document.forms(0).all("username").Value(e-mail address removed)"
IE.document.forms(0).all("password").Valuenott2017*"
IE.document.forms(0).submit
' 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
itm.Focus
Application.SendKeys "{TAB}", True
Application.SendKeys "~", True
Exit For
End If
End If
Next
End Sub
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 ("https://www.proyectos.cl/attachments/download/28170/DivSeguridad2020170714.xlsx")
Do
If IE.readyState = 4 Then
IE.Visible = True
Exit Do
Else
DoEvents
End If
Loop
IE.document.forms(0).all("username").Value(e-mail address removed)"
IE.document.forms(0).all("password").Valuenott2017*"
IE.document.forms(0).submit
' 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
itm.Focus
Application.SendKeys "{TAB}", True
Application.SendKeys "~", True
Exit For
End If
End If
Next
End Sub