I have an Excel document. It creates an Internet Explorer instance and navigates to a URL.
*I am testing this with duckduckgo*
I want to be able to respond, within vba, to a button being clicked on the website.
`html.querySelector("#search_button_homepage")` finds the input element, how can I detect the onclick event and run some vba code?
My goal is to fill some cells in the spreadsheet with the data the user filled in on the web form. I can grab the data, I just need to know when the user is done (i.e. they clicked submit)
*I am testing this with duckduckgo*
I want to be able to respond, within vba, to a button being clicked on the website.
`html.querySelector("#search_button_homepage")` finds the input element, how can I detect the onclick event and run some vba code?
My goal is to fill some cells in the spreadsheet with the data the user filled in on the web form. I can grab the data, I just need to know when the user is done (i.e. they clicked submit)
VBA Code:
Private Sub cmdTest_Click()
Dim IE As InternetExplorer, html As Object
Set IE = New InternetExplorer
Dim link As String
link = "http://www.duckduckgo.com/"
With IE
.Visible = True
.navigate link
While .Busy = True Or .readyState < 4
DoEvents
Wend
Set html = .document
html.querySelector("#search_button_homepage")
' Respond to html.querySelector("#search_button_homepage") being clicked.
End With
ShowWindow IE.hwnd, SW_SHOWMAXIMIZED
End Sub