Boa tarde.
Segue o código que construí até o momento:
Private Sub CommandButton_CONSULTAR_Click()
On Error Resume Next
Dim objIE As InternetExplorer
Dim elem
Dim tbl
Dim tr
Set objIE = CreateObject("InternetExplorer.Application") 'UserForm2.WebBrowser1
With objIE
.StatusBar = False
.Toolbar = False
.Width = 1000
.Height = 600
.Resizable = False
.AddressBar = False
.Visible = True
.Top = 200
.Left = 150
.Navigate "http://smap14.mda.gov.br/extratopf/PesquisaTitular.aspx"
Do While .Busy Or _
.ReadyState <> 4
DoEvents
Loop
.Document.all.Item("ctl00_ctl00_CONTENTEXTRATO_ContentPlaceHolder1_txtCPF").innertext = TextBox_CPF
reset:
.Document.getElementById("ctl00_ctl00_CONTENTEXTRATO_ContentPlaceHolder1_txtUserCode").Focus
x = .Document.activeElement.Name
Do While x = "ctl00_ctl00_CONTENTEXTRATO_ContentPlaceHolder1_txtUserCode"
x = .Document.activeElement.Name
DoEvents
Loop
If .Document.all.Item("ctl00_ctl00_CONTENTEXTRATO_ContentPlaceHolder1_txtUserCode").Value = "" Then GoTo reset
.Document.all("ctl00$ctl00$CONTENTEXTRATO$ContentPlaceHolder1$btnPesquisar").submit
Do While .Busy Or _
.ReadyState <> 4
DoEvents
Loop
End With
End Sub
Postado : 10/02/2016 1:25 pm