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

amo

Board Regular
Joined
Apr 14, 2020
Messages
141
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

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
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.
 
Upvote 0
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 …​
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,868
Members
449,053
Latest member
Mesh

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