WiseOwl Training - Established 1992 Wise Owl Training

Established May 1992
30 years in business
Wise Owl Training
30 years in business
See 482 reviews for our classroom and online training

Details for Smithy58

Smithy58 has participated in the following threads:

Added by Smithy58 on 29 Feb 2020 at 17:17

Hi Andrew

I am very impressed with the web scraping course and it is presented very well.  i am however a bit stuck on the code where it stops on the For HTMLButton ... loop stating an object is required.   I have been over the code and cannot see anything different to what you have in the video, can you please help on this?

Sub GetHTMLDocument()

    Dim IE As New SHDocVw.InternetExplorer
    Dim HTMLDoc As MSHTML.HTMLDocument
    Dim HTMLInput As MSHTML.IHTMLElement
    Dim HTMLButtons As MSHTML.IHTMLElementCollection
    Dim HTMLButton As MSHTML.IHTMLElement
   
    IE.Visible = True
    IE.navigate "wiseowl.co.uk"
   
    Do While IE.ReadyState <> READYSTATE_COMPLETE
   
    Loop

    Set HTMLDoc = IE.Document
    Set HTMLInput = HTMLDoc.getElementById("what")
    HTMLInput.Value = "Excel VBA"
   
    Set HTMLBittons = HTMLDoc.getElementsByTagName("button")
   
    For Each HTMLButton In HTMLButtons
    Debug.Print HTMLButton.className, HTMLButton.tagName, HTMLButton.ID, HTMLButton.innerText
    Next HTMLButton
   
End Sub

 

Thanks in advance

Colin

 

Added by Smithy58 on 03 Mar 2020 at 16:34

Hi  i was wondering if you have anything on scraping websites using Chrome and Excel VBA?

Regards

Colin