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

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
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,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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