I am quite new to coding and have the following issue: I want to write a macro, that goes to the website: https://displaypurposes.com/ inserts a keyword and copy the results into my excel sheet.
This is how my code looks at the moment:
Sub DisplayPurposes()
Dim objIE As InternetExplorer
Dim aEle As HTMLLinkElement
Dim Url As String
Dim Keyword As String
Url = "https://displaypurposes.com/"
Keyword = "skiing"
'initiating a new instance of Internet Explorer and assigning it to objIE
Set objIE = New InternetExplorer
'make IE browser visible (False would allow IE to run in the background)
objIE.Visible = True
'navigate IE to this web page (a pretty neat search engine really)
objIE.navigate (Url)
'Wait for IE to load page
Do While objIE.Busy = True Or objIE.readyState <> 4: DoEvents: Loop
'BOTH OF THESE INSERT THE KEYWORD
'Insert Version 01
objIE.document.getElementsByTagName("input")(0).innerText = "Keyword"
'Insert Version
objIE.document.getElementsByTagName("input")(0).Value = "Keyword"
'NOW I DON'T KNOW HOW TO MAKE THE PAGE UPDATE ITSELF
End Sub
I figured out that I might be able to solve the problem with .fireEvent(), Sendkeys or the solution posted by dyanisis2
Set evt = objIE.Document.createEvent("keyboardevent")
evt.initEvent "change", True, False
PW.all(0).dispatchEvent evt
However, I didn't manage to make the page show the searchresults for the keyword so I could scrape them. Since I am quite new to the community I hope I posted everything according to the guidelines and answered everything you need to know!