#1
|
|||
|
|||
getElementsByClassName error code 424
The following Excel macro code works on my laptop, but my desktop chokes when it gets to the red lines of code below (Runtime error 424 Object required ). The Excel file is stored on OneDrive so that I can share the file between my laptop and my desktop. Both devices have the latest Windows 10 64-bit build and have the latest Office 365 subscription account, so Excel and its macros should run the same on both devices. Both computers use the latest Firefox browser.
With Sheets("Instructions") .Range("CurrentPrice") = html.getElementsByClassName("Trsdu(0.3s) Fw(b) Fz(36px) Mb(-4px) D(ib)").Item(0).innerText ' .Range("CurrentPrice") = html.getElementsByClassName("Px(10px)")(0).getElem entsByTagName("span")(1).innerText .Range("LowPrice") = html.getElementsByClassName("Px(10px)")(0).getElem entsByTagName("span")(7).innerText .Range("HighPrice") = html.getElementsByClassName("Px(10px)")(0).getElem entsByTagName("span")(9).innerText .Range("AvgPrice") = html.getElementsByClassName("Px(10px)")(0).getElem entsByTagName("span")(3).innerText .Range("SI_score") = html.querySelector("[data-test='rec-rating-txt'").innerText 'Recommendation score Sheets("Instructions").Range("Date_PriceTargets") = Now() End With The macro scrapes data values from a webpage... (00YEENBRIDGE INC (ENB.TO) Stock Price, News, Quote & History - Yahoo Finance) ...and enters the data into the "Instructions" worksheet. As I mentioned above, my laptop has no trouble scraping all 5 data values. But my desktop can only scrape the "CurrentPrice" value, which is on the same webpage as the other 4 values. Initially I couldn't get the CurrentPrice either, but I found its value duplicated at the top of the webpage, so I pointed to that ClassName instead ie. "Trsdu" (as a temporary workaround). Both computers have no trouble scraping the CurrentPrice value, and my laptop has no problem scraping the 4 remaining values. Please note that the duplicate CurrentPrice value and the 4 remaining values are located off to the right side of the webpage in a separate frame called "Analysts Price Targets". Don't know if that has anything to do with it. More importantly, my desktop used to be able to scrape all 5 data values without a problem, but recently (2 weeks ago) stopped. Now I get the Object Required error. Something changed, and I don't know if it's in Excel or Firefox. It can't be the macro because it's the same Excel file running the same macro, it's the same operating system, it's the same version of Office 365 and it's the same version of Firefox on both devices. Any ideas? |
#2
|
|||
|
|||
After extensive discussion and unsuccessful attempts by Microsoft Online Support agents, I have reluctantly resolved this issue by creating a new user profile. This issue is now closed.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Error Msg re: 64-bit code | cwhaley | Excel | 0 | 01-02-2017 01:24 PM |
Error in VBA code | ozman86 | Excel Programming | 3 | 11-27-2014 01:06 PM |
error code 30029-4 | zignaasa | Office | 0 | 05-24-2014 10:07 PM |
IE9- "document.getElementsByClassName" problem | tinfanide | Excel Programming | 6 | 01-14-2012 08:05 AM |
Error code 0x800CCC80 | Kevin | Outlook | 1 | 03-18-2011 07:20 AM |