Private Sub IE_Autiomation()
Dim i As Long
Dim IE As Object
Dim objElement As Object
Dim objCollection As Object
' Create InternetExplorer Object
Set IE = CreateObject("InternetExplorer.Application")
' You can uncoment Next line To see form results
IE.Visible = False
' Send the form data To URL As POST binary request
IE.Navigate "https://sms.comtele.com.br/"
' Wait while IE loading...
Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop
Set objCollection = IE.document.getElementsByTagName("input")
i = 0
While i < objCollection.Length
If objCollection(i).Name = "Username" Then
' Set text for search
objCollection(i).Value = "Barry"
Else
If objCollection(i).Type = "password" And _
objCollection(i).Name = "Password" Then
objCollection(i).Value = "Password"
' "Search" button is found
Set objElement = objCollection(i)
End If
End If
i = i + 1
Wend
Set ElementCol = IE.document.getElementsByClassName("btn btn-success")
For Each btnInput In ElementCol
btnInput.Click
Next btnInput
' Wait while IE re-loading...
Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop
' Show IE
IE.Visible = True
' Clean up
Set IE = Nothing
Set objElement = Nothing
Set objCollection = Nothing
End Sub