VBA error when pulling data from table

bensdb

New Member
Joined
Jan 24, 2014
Messages
18
I'm trying to pull some sales data from a table on a website....

Seem to be stuck, getting "error 70 permission denied"..Is my code correct?

Here is a snippet...everything up to this point is OK...I think it is the "innertext" line that might be erroneous.

Code:
Set html = ie.Document    
    Set tablediv = html.getElementById("reportData")
    Set trs = tablediv.getElementsByTagName("tr")
    For Each tr In trs
        Set tds = tr.getElementsByTagName("td")
        rownum = rownum + 1


        For Each td In tds
            cellnum = cellnum + 1
            If Not td Is Nothing Then
                ws2.Cells(rownum + LastRow, cellnum).Value = td.innerText
            End If
        Next
    Next

I've got the relevant references included.

Basically I'm parsing through a table and adding the data to my worksheet.

Thanks for your help!
 
Last edited:

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
How good are you at debugging - do you use the immediate window and/or the watch window?

- Using Watch window: When your code breaks, what is the value for td? or td.innertext?
- Using Immediate window, manually: when code breaks, type "?td.innertext" and hit enter, what happens?
- Using Immediate window automatically, add code line debug.print td.innertext after your IF line and before your innertext line. What is showing in the Immediate window when your code breaks? Or does it break on this new line?
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,021
Latest member
Mohamed Magdi Tawfiq Emam

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