I'm trying to use a macro to download a spreadsheet on a system. However from ReadyState < > 4
the code no longer works.
Sub FazerLoginSite()
Dim i As Long
Dim IE As Object
Dim objElement As Object
Dim Element As Object
Dim objCollection As Object
Dim tabela As Object
Dim doc As Object
Dim lb As Object
Dim opt As Object
Set IE = CreateObject("InternetExplorer.application")
With IE
.Visible = True
.Navigate ("sistema")
While .Busy Or .ReadyState <> 4:
DoEvents:
Wend
.Document.getElementById("UserName").Focus
.Document.getElementById("UserName").Value = "login"
.Document.getElementById("Password").Focus
.Document.getElementById("Password").Value = "senha"
.Document.all("btnEntrar").Click
Debug.Print .LocationURL
With IE
.Navigate ("sistema")
While .Busy Or .ReadyState <> 4:
DoEvents:
Wend
Application.Wait (Now + TimeValue("0:00:05"))
.Document.getElementById("barraFiltro").Click
.Document.all.Item("radioTipoHierarquiaDropDownFiltroHierarquia").Item(1).Click
Application.Wait (Now + TimeValue("0:00:02"))
.Document.all.Item("DropDownTreeDropDownFiltroHierarquia").Click
Application.Wait (Now + TimeValue("0:00:01"))
Application.SendKeys "{TAB}", True
Application.SendKeys "{ENTER}", True
Application.Wait (Now + TimeValue("0:00:03"))
.Document.getElementById("DatePickerDataSolicitacaoDe").Focus
.Document.getElementById("DatePickerDataSolicitacaoDe").Value = "01/10/2018"
.Document.getElementById("DatePickerDataPeriodoDe").Focus
.Document.getElementById("DatePickerDataPeriodoDe").Value = "01/10/2018"
.Document.getElementById("MultiSelectBox-MultiSelectBoxStatus").Click
.Document.all.Item("Cancelado").Click
.Document.all.Item("Executado no WFM").Click
.Document.all.Item("Direcionado ao WFM").Click
.Document.all.Item("Reprovado WFM").Click
.Document.getElementById("MultiSelectBox-MultiSelectBoxStatus").Click
'.Document.getElementById("SelecionadoDropDownFiltroHierarquia").Click
Application.Wait (Now + TimeValue("0:00:01"))
.Document.getElementById("btnFiltro").Click
Application.Wait (Now + TimeValue("0:00:02"))
.Document.getElementById("checkboxCkAll").Click
Application.Wait (Now + TimeValue("0:00:05"))
.Document.getElementById("buttonExpExcelSoc").Click
Do While .Busy
DoEvents
Loop
Debug.Print .LocationURL
End With
End With
End Sub