I am trying to fire the event we see when user writes a ticker code in a input field text and press enter
the line works:
ie.Document.all("ticker").innertext = "BBDCF230"
But just after, pressing enter, the webpage loads data from "BBDCF230" code into the others fields. I am trying to do this using :
Application.SendKeys "~" '## send the "Enter" keystroke
but its not working. Any Ideas?
Sub dxArray(ticker As String, ByRef premioEstimada() As truple, Optional mostrar As Boolean)
Dim ie As InternetExplorer
Set ie = New InternetExplorer
If mostrar = True Then
ie.Visible = True
Else
ie.Visible = False
End If
Application.StatusBar = "DX: " & ticker
ie.Navigate "https://opcoes.net.br/calculadora-Black-Scholes/" & ticker
Do While ie.Busy = True Or ie.ReadyState <> READYSTATE_COMPLETE 'Equivalent = .ReadyState <> 4
Application.Wait (Now + TimeValue("00:00:01")) 'Wait 1 second, then check again.
Loop
ww1 = ie.Document.all("premioDaOpcao").Value
For i = 0 To UBound(premioEstimada)
ie.Document.all("ticker").innertext = ""
ie.Document.all("ticker").innertext = "BBDCF230"
Application.SendKeys "~" '## send the "Enter" keystroke
ie.Document.all("cotacaoAcao").innertext = Replace(CStr(premioEstimada(i).cotacao), ".", ",")
ie.Document.all("btncalcular").Click
Do While ie.Busy = True Or ie.ReadyState <> READYSTATE_COMPLETE Or ie.Document.all("premioDaOpcao").Value = "" 'Equivalent = .ReadyState <> 4
Application.Wait (Now + TimeValue("00:00:01")) 'Wait 1 second, then check again.
Loop
premioEstimada(i).premioEstimado = ie.Document.all("premioDaOpcao").Value
premioEstimada(i).ticker = ticker
Next i
ie.Quit
Set ie = Nothing`enter code here`
End Sub
"https://opcoes.net.br/calculadora-Black-Scholes/" & tickeryou have what you want. The rest of your code has a lot of errors. Two examples: You cannot useSendkeys()if IE is not visible and to set the value of an input text box you must useValuenotinnerText. But like I say, you only need the url with the ticker at it's end.