• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA Web Scraping InternetExplorer Object Error

exc4libur

Member
Hi all,

I am web scraping and I found this code which open IE on memory and extracts the information I need. However, I keep getting this message: "Run time error 429: ActiveX component can't create object". I tried changing the "Set IE = New InternetExplorer" to "Set IE = CreateObject("InternetExplorer.Application")" but still got the error.

I have referenced: Microsoft Internet Controls and Microsoft HTML Object Library.
I am using Windows 10.

Please find the code below.

Best Rgds.,
Exc4.

Code:
Enum READYSTATE
READYSTATE_UNINITIALIZED = 0
READYSTATE_LOADING = 1
READYSTATE_LOADED = 2
READYSTATE_INTERACTIVE = 3
READYSTATE_COMPLETE = 4
End Enum

Sub ImportStackOverflowData()

'Source: http://www.wiseowl.co.uk/blog/s393/scrape-website-html.htm

'to refer to the running copy of Internet Explorer
Dim ie As InternetExplorer
'to refer to the HTML document returned
Dim html As HTMLDocument
'open Internet Explorer in memory, and go to website
Set ie = New InternetExplorer
ie.Visible = False
ie.navigate "http://stackoverflow.com/"
'Wait until IE is done loading page
Do While ie.readyState <> READYSTATE_COMPLETE
Application.StatusBar = "Trying to go to StackOverflow ..."
DoEvents
Loop
'show text of HTML document returned
Set html = ie.document
MsgBox html.DocumentElement.innerHTML
'close down IE and reset status bar
Set ie = Nothing
Application.StatusBar = ""
End Sub
 

Hi !

For this kind of stuff, better is to use a request
like I yet showed you in at least 3 of your previous threads …
 
Back
Top