MathHopeful
MathHopeful

Reputation: 69

Using the Internet Explorer object to scrape information?

I am attempting to scrape some information from a website. The link I am referencing is: https://web.tmxmoney.com/quote.php?qm_symbol=WEED

I'm creating an Internet Explorer object with the following:

Dim appIE As Object
Set appIE = CreateObject("internetexplorer.application")

Dim ticker As String
ticker = "BRB"

With appIE
    .Navigate "https://web.tmxmoney.com/quote.php?qm_symbol=" & ticker
    .Visible = False
End With

Do While appIE.Busy
Loop

I am then attempting to get the contents of a class with the following:

Set testing = appIE.document.getElementsByClassName("quote-name")(0).textContent
Debug.Print (testing)

However, I am receiving the error: Type Mismatach. The following code will run fine though: appIE.document.getElementsByClassName("quote-name").

My desired content is the following and can run this fine in the IE console.

"
                    Brick Brewing Co. Limited
                    Exchange: TSX Exchange |
                                                        Jul 26, 2017, 2:46 PM EDT                                               "

Any ideas on what might be wrong?

Upvotes: 0

Views: 86

Answers (1)

Arun Raj
Arun Raj

Reputation: 37

Try these lines of code

testing = appIE.document.getElementsByClassName("quote-name")(0).textContent

Debug.Print (testing)

Upvotes: 1

Related Questions