Results 1 to 39 of 39

Scraping data from a website table

Threaded View

  1. #1
    Forum Contributor
    Join Date
    12-14-2012
    Location
    Perth
    MS-Off Ver
    Excel 2010
    Posts
    208

    Scraping data from a website table

    Hi, I am getting the following error message when I run the code below. The code works perfectly well when I used it on different websites.


    Run-time error '91':
    Object variable or With block variable not set




    I am not sure if its the code or the website that's causing the error?

    Sub Sample()
    
        Dim IE As New InternetExplorer
        Dim sht As Worksheet
        Dim rRng As Range
        Dim ele As Object
        Dim lRow As Range
        Dim LastRow As Long
        
        Dim name As String
    
    
        Set sht = ThisWorkbook.Worksheets("Sample")
        
        sht.Range("D3:M1000").Select
        Selection.ClearContents
    
        IE.navigate "website address"
        
        Do While IE.Busy = True Or IE.readyState <> 4: DoEvents: Loop
        
            Set Doc = IE.document
            LastRow = sht.Cells(sht.Rows.Count, "D").End(xlUp).Row
            y = 3
            
            For Each ele In Doc.getElementsByClassName("c-table-container").getElementsByTagName("Table")(0).getEelementsByTagName("tbody")(0).getElementsByTagName("tr")
            
            name = Trim(ele.getElementsByTagName("td")(2).innerText)
    
            sht.Range("D" & y).Value = name
    
                y = y + 1
            Next
    
    
        IE.Quit
        Set IE = Nothing
        
        'ActiveWorkbook.Save
        
    End Sub

    Any suggestions? Thank you.
    Last edited by jjin; 08-09-2018 at 03:42 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA website scraping - multiple link clicks to show full table
    By Offspring21 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-17-2018, 11:24 AM
  2. [SOLVED] Help in scraping data from website
    By Chrispelletier in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-15-2018, 09:00 AM
  3. Trouble Scraping data from a website
    By chrisellis250 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-13-2017, 09:07 AM
  4. Cleaning up data from scraping website URL
    By king0r1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-27-2016, 08:42 AM
  5. [SOLVED] Scraping data from website
    By novicevba in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-22-2016, 11:02 AM
  6. Data Scraping from the WebSite
    By sathis in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-26-2015, 10:46 AM
  7. scraping data from a website
    By redpanda in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-05-2012, 01:20 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1