Hi all,
Some months ago I've written a code to go to a webpage, click on some buttons within the page (IE.Docs.ElementById), do this again with adjusting some filters, and copy paste this to an excel..
now, since last month It stopped working . It gets stuck at obj.IE.Document.getElementById("searchSolrButton").Click with the pop up: Run-time error "-2147467259 (80004005): automation error, unspecified error"
Does anybody here knows how to solve this? Many thanks!
Some months ago I've written a code to go to a webpage, click on some buttons within the page (IE.Docs.ElementById), do this again with adjusting some filters, and copy paste this to an excel..
now, since last month It stopped working . It gets stuck at obj.IE.Document.getElementById("searchSolrButton").Click with the pop up: Run-time error "-2147467259 (80004005): automation error, unspecified error"
Does anybody here knows how to solve this? Many thanks!
VBA Code:
'start a new subroutine called SearchBot
Sub SearchBot()
'dimension (declare or set aside memory for) our variables
Dim objIE As InternetExplorer 'special object variable representing the IE browser
Dim aEle As HTMLLinkElement 'special object variable for an <a> (link) element
Dim y As Integer 'integer variable we'll use as a counter
Dim result As String 'string variable that will hold our result link
'initiating a new instance of Internet Explorer and asigning 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 ("https://registers.esma.europa.eu/publication/searchRegister?core=esma_registers_bench_entities")
'wait here a few seconds while the browser is busy
While objIE.Busy
DoEvents
Wend
'click the 'go' button
objIE.Document.getElementById("searchSolrButton").Click
'wait again for the browser
While objIE.Busy
DoEvents
Wend
'Set table size to 100 values
objIE.Document.getElementById("tablePageSize").Click
objIE.Document.getElementById("tablePageSize").selectedIndex = 3
objIE.Document.getElementById("searchSolrButton").Click
'the first search result will go in row 2
y = 2
'for each <a> element in the collection of objects with class of 'result__a'...
For Each aEle In objIE.Document.getElementsByClassName("Tabular TabularScroll")
'...get the href link and print it to the sheet in col C, row y
result = aEle
Sheets("ESMAoutput").Range("C" & y).Value = result
'...get the text within the element and print it to the sheet in col D
Sheets("ESMAoutput").Range("D" & y).Value = aEle.innerText
Debug.Print aEle.innerText
'increment our row counter, so the next result goes below
y = y + 1
'repeat times the # of ele's we have in the collection
Next
'close the browser
objIE.Quit
MsgBox "ESMA register has been updated succesfully"
Sheets("Dashboard").Select
Exit Sub