- 24 Jan 2020 às 18:39
#51945
Prezados, boa noite
Consigo executar a maior parte da macro para acessar o site https://sitenet.serasa.com.br/Logon/.
Inseri o usuário a senha, tudo certo, mas não consigo programar o VBA para clicar no botão de acesso para o LOGIN
Ao inspecionar o elemento nesse visualizo:
<a id="acessar" href="#" class="btn btn-blue btn-block envia-form">Acessar</a>
O código que escrevi foi:
Sub ACESSO()
If Range("A" & ActiveCell.Row).Value = Empty Then
MsgBox "Por favor, preencha o número da conta!"
Exit Sub
Else
End If
If Range("B" & ActiveCell.Row).Value = Empty Then
MsgBox "Por favor, preencha o número da agência!"
Exit Sub
Else
End If
If Range("C" & ActiveCell.Row).Value = Empty Then
MsgBox "Por favor, preencha o número do cheque!"
Exit Sub
Else
End If
On Error Resume Next
If Rows(ActiveCell.Row).RowHeight > 0.1 Then
Range("K" & ActiveCell.Row).Select
Else
End If
Dim HTMLDoc As HTMLDocument
Dim oBrowser As InternetExplorer
Dim oHTML_Element As IHTMLElement
Dim sURL As String
On Error GoTo Err_Clear
sURL = "https://sitenet.serasa.com.br/Logon/"
Set oBrowser = New InternetExplorer
oBrowser.Silent = True
oBrowser.timeout = 60
oBrowser.Navigate sURL
oBrowser.Visible = True
Do
Loop Until oBrowser.ReadyState = READYSTATE_COMPLETE
Set HTMLDoc = oBrowser.Document
HTMLDoc.all.LOGON.Value = "meu usuario"
HTMLDoc.all.SENHA.Value = "minha senha"
'''Nesse ponto não consigo desenolver
For Each oHTML_Element In HTMLDoc.getElementsByTagName("input")
If oHTML_Element.Type = "submit" Then oHTML_Element.Click: Exit For
Err_Clear:
Resume Next
Label1.Text = e.X.toString()
Label2.Text = e.Y.toString()
End sub
Alguém pode me ajudar por favor?
Obrigado!
Consigo executar a maior parte da macro para acessar o site https://sitenet.serasa.com.br/Logon/.
Inseri o usuário a senha, tudo certo, mas não consigo programar o VBA para clicar no botão de acesso para o LOGIN
Ao inspecionar o elemento nesse visualizo:
<a id="acessar" href="#" class="btn btn-blue btn-block envia-form">Acessar</a>
O código que escrevi foi:
Sub ACESSO()
If Range("A" & ActiveCell.Row).Value = Empty Then
MsgBox "Por favor, preencha o número da conta!"
Exit Sub
Else
End If
If Range("B" & ActiveCell.Row).Value = Empty Then
MsgBox "Por favor, preencha o número da agência!"
Exit Sub
Else
End If
If Range("C" & ActiveCell.Row).Value = Empty Then
MsgBox "Por favor, preencha o número do cheque!"
Exit Sub
Else
End If
On Error Resume Next
If Rows(ActiveCell.Row).RowHeight > 0.1 Then
Range("K" & ActiveCell.Row).Select
Else
End If
Dim HTMLDoc As HTMLDocument
Dim oBrowser As InternetExplorer
Dim oHTML_Element As IHTMLElement
Dim sURL As String
On Error GoTo Err_Clear
sURL = "https://sitenet.serasa.com.br/Logon/"
Set oBrowser = New InternetExplorer
oBrowser.Silent = True
oBrowser.timeout = 60
oBrowser.Navigate sURL
oBrowser.Visible = True
Do
Loop Until oBrowser.ReadyState = READYSTATE_COMPLETE
Set HTMLDoc = oBrowser.Document
HTMLDoc.all.LOGON.Value = "meu usuario"
HTMLDoc.all.SENHA.Value = "minha senha"
'''Nesse ponto não consigo desenolver
For Each oHTML_Element In HTMLDoc.getElementsByTagName("input")
If oHTML_Element.Type = "submit" Then oHTML_Element.Click: Exit For
Err_Clear:
Resume Next
Label1.Text = e.X.toString()
Label2.Text = e.Y.toString()
End sub
Alguém pode me ajudar por favor?
Obrigado!