How to fix The object invoked has disconnected from its clients using vba

amo

Board Regular
Joined
Apr 14, 2020
Messages
96
Office Version
  1. 2010
Platform
  1. Windows
previously no problem , but now it doesn't work
any ideas ?




Screenshot_1.png


VBA Code:
Sub getdata()
   
    
    
    Dim HTMLDoc As New HTMLDocument
    Dim ieBrowser As New InternetExplorer
    
    'variable to specify the row number in excel
    Dim lastRow As Integer, rowno As Integer
    Dim tag As Object
    
    lastRow = ActiveSheet.Cells(ActiveSheet.Rows.Count, "A").End(xlUp).Row
    
    
    For i = 3 To lastRow
        URLNAME = Cells(i, 1).Value
        
        ieBrowser.Visible = True
        ieBrowser.navigate URLNAME
        
        Do
       
        Loop Until ieBrowser.readyState = READYSTATE_COMPLETE
        
        Set HTMLDoc = ieBrowser.document
        
        Application.Wait (Now + TimeValue("0:00:05"))
        
        'Price
        ActiveSheet.Cells(rowno, 4) = HTMLDoc.getElementsByClassName("AJyN7v")(0).innerText
        'Stock
        ActiveSheet.Cells(rowno, 5) = HTMLDoc.getElementsByClassName("_2ZcUKh")(0).innerText
        
    Next
    Set ieBrowser = Nothing
    Set HTMLDoc = Nothing
End Sub
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

johnnyL

Well-known Member
Joined
Nov 7, 2011
Messages
1,354
Office Version
  1. 2013
  2. 2007
Platform
  1. Windows
It looks like you are not connecting to the URL address, possibly from your IP being banned, perhaps the Internet Explorer browser is no longer supported.

See if the URL loads in internet explorer and respond back.
 

Marc L

Well-known Member
Joined
Apr 5, 2021
Messages
1,264
Office Version
  1. 2010
Platform
  1. Windows
any ideas ?
No idea as you forgot the essential : in which codeline the error raises ?‼​
But according to this VBA procedure I just can say you was lucky if really it has worked …​
 

Forum statistics

Threads
1,141,714
Messages
5,708,013
Members
421,540
Latest member
quocbinh

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
Top