QuerySelectorAll is Crashing IE 11

dyanisis2

New Member
Joined
Jan 2, 2015
Messages
12
I am trying to read in a table of numbers from an investing website. The link is located below.

Income Statement for Coach Inc (COH) from Morningstar.com

I'm reading it in using the vba code below:
Code:
Dim Income As Object
Dim Incomee As Object

Set Income = IE.Document.getElementsByClassName("r_xcmenu rf_table")(0).querySelectorAll("div.rf_crow, div.rf_crow0, div.rf_subtotal")
For Each Incomee In Income
    For j = 0 To Incomee.all.length - 1
        ActiveCell.Offset(0, j) = Incomee.all(j).innerText
    Next
    ActiveCell.Offset(1, 0).Select
Next

The good thing is that it seems to work fine at grabbing the values. The problem is that once it's completed, when it tries to move on to the next line of code, IE crashes with a "IE has stopped responding" type of error, and windows has to re-open IE. Unfortunately, this causes my code to stop because the instance of IE quit. Anyone know why IE would be crashing at the end of these lines of code?

Any help would be appreciated. THanks
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
A while since this post - but did this got solved somehow?

Or any walkaround that still QuerySelectorAll?


I am trying to read in a table of numbers from an investing website. The link is located below.

Income Statement for Coach Inc (COH) from Morningstar.com

I'm reading it in using the vba code below:
Code:
Dim Income As Object
Dim Incomee As Object

Set Income = IE.Document.getElementsByClassName("r_xcmenu rf_table")(0).querySelectorAll("div.rf_crow, div.rf_crow0, div.rf_subtotal")
For Each Incomee In Income
    For j = 0 To Incomee.all.length - 1
        ActiveCell.Offset(0, j) = Incomee.all(j).innerText
    Next
    ActiveCell.Offset(1, 0).Select
Next

The good thing is that it seems to work fine at grabbing the values. The problem is that once it's completed, when it tries to move on to the next line of code, IE crashes with a "IE has stopped responding" type of error, and windows has to re-open IE. Unfortunately, this causes my code to stop because the instance of IE quit. Anyone know why IE would be crashing at the end of these lines of code?

Any help would be appreciated. THanks
 
Upvote 0

Forum statistics

Threads
1,224,581
Messages
6,179,668
Members
452,936
Latest member
anamikabhargaw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top