+ Reply to Thread
Results 1 to 11 of 11

Webpage scraping into Excel - Run-time error '438': Object doesn't support this property..

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    10-29-2009
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    125

    Webpage scraping into Excel - Run-time error '438': Object doesn't support this property..

    Hi

    I am trying to get a full list of shares (1289 rows in total) from LSE website into Excel, but I get an error "Run-time error '438': Object doesn't support this property or method'' and, as I am a novice wasn't sure how to fix it.

    I wondered if you may assist me?

    Below is my code and error appears at "For t = 0 To (elemCollection" section-

    Sub ImportLSEData()
            Dim IE As Object, obj As Object
            Dim t As Integer, r As Integer, c As Integer
            Dim elemCollection As Object
            
            Set IE = CreateObject("InternetExplorer.Application")
            
            With IE
            .Visible = True
            .navigate "http://www.londonstockexchange.com/exchange/prices-and-markets/stocks/prices-search/stock-prices-search.html"
            
            While IE.readyState <> 4
            DoEvents
            Wend
            
            Set obj = IE.document.all.Item
                  
            Set elemCollection = IE.document.getElementsByTagName("table")
            
            For t = 0 To (elemCollection.Length - 1)
            For r = 0 To (elemCollection(t).Rows.Length - 1)
            For c = 0 To (elemCollection(t).Rows(r).Cells.Length - 1)
            
            ThisWorkbook.Worksheets(1).Cells(r + 1, c + 1) = elemCollection(t).Rows(r).Cells(c).innerText
            Next c
            Next r
            Next t
            
            End With
            
            Set IE = Nothing
            
               
        End Sub
    Much appreciated!
    Last edited by kaseyleigh; 12-27-2014 at 07:52 PM.

  2. #2
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Webpage scraping into Excel - Run-time error '438': Object doesn't support this proper

    It's a typo problem, change all your "lenght" in the "for to...." lines to length. This should do the trick.
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  3. #3
    Forum Contributor
    Join Date
    10-29-2009
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    125

    Re: Webpage scraping into Excel - Run-time error '438': Object doesn't support this proper

    I can't believe it! LOL !

    Thank you!

  4. #4
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Webpage scraping into Excel - Run-time error '438': Object doesn't support this proper

    LOL, not a problem, I do it SEVERAL times a day!

  5. #5
    Forum Contributor
    Join Date
    10-29-2009
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    125

    Re: Webpage scraping into Excel - Run-time error '438': Object doesn't support this proper

    Hi

    Any ideas on how to populate my sheet with all 1289 pages from the website?
    Been battling all day on it and get no where.

    My code above only works on the 1st page and I can't get it to continue down my sheet with pages 2 onwards to 1289.

    I'd appreciate any help you may give

    Thanks!

  6. #6
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Webpage scraping into Excel - Run-time error '438': Object doesn't support this proper

    I'm not sure how to accomplish this either, but I will look into it. Hopefully someone else will see this and know what to do.
    Last edited by gmr4evr1; 12-27-2014 at 08:15 PM. Reason: Correct a typo

  7. #7
    Forum Contributor
    Join Date
    10-29-2009
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    125

    Re: Webpage scraping into Excel - Run-time error '438': Object doesn't support this proper

    Awesome - thanks!

    Hopefully you'll have cracked by tomorrow - it already is 'tomorrow' for me 00:20. Good night

  8. #8
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Webpage scraping into Excel - Run-time error '438': Object doesn't support this proper

    I'm not sure about this, but wouldn't running your code for 1200+ pages make it drastically slow??

  9. #9
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Webpage scraping into Excel - Run-time error '438': Object doesn't support this proper


    Hi,

    yes indeed, at least 15 min (with fastest requests) up to 4 times more (piloting IE) !

    Easier way is to import a file …

  10. #10
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Webpage scraping into Excel - Run-time error '438': Object doesn't support this proper

    Hello kaseyleigh,

    This workbook will pull all the pages from the site onto a single worksheet. This is much faster than Internet Explorer but will still take some time to finish as each page has to be retrieved from the server.

    Good news is you can do other things while this is running. Test it out and let me know what you think.
    Attached Files Attached Files
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  11. #11
    Forum Contributor
    Join Date
    10-29-2009
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    125

    Re: Webpage scraping into Excel - Run-time error '438': Object doesn't support this proper

    Awesome! Thank you very much

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Run time error '438': Object doesn't support this property or method
    By baig123 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-27-2014, 04:59 AM
  2. Run-time error '438': Object doesn't support this property or method
    By ThaGreenMoose in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-04-2011, 01:17 PM
  3. Run-time error '438' Object doesn't support this property or method
    By Lothar69 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-26-2011, 03:30 PM
  4. Run-Time Error '438' - Object doesn't support this property or method
    By rajibyumnam in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-26-2011, 03:24 AM
  5. Run-time error '438': Object doesn't support this property or method
    By ophelia in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-23-2007, 05:27 AM

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