Automation Error: The object invoked has disconnected from its clients

Shweta

Well-known Member
Joined
Jun 5, 2011
Messages
514
Hi All,

I am facing the below error while running the macro.

Run-time error- '2147417848(80010108)'
Automation Error: The object invoked has disconnected from its clients

This macro is working fine when I am running it in excel 2007 with IE version 7 But giving the above error while running on excel 2010 with IE ver 2010.

Option Explicit is already added in the macro.

Rich (BB code):
Sub ie_busy()
  Do While IE.Busy = True
       DoEvents
    Loop
 
    Do While IE.ReadyState <> 4
       DoEvents
    Loop
    
    Do Until IE.Document.ReadyState = "complete"
       DoEvents
    Loop
End Sub

Getting the error on the bold line.

Please suggest.

Shweta.
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Is that all the code?

Where have you defined IE?
 
Upvote 0
This is just a small part of the code. I am calling this in the main code. Main code is
Rich (BB code):
Option Explicit
Dim IE As SHDocVw.InternetExplorer
Public ctrl_ID As String
Dim Start_Date As Date
Dim k, inx, x, cnt As Integer
Dim link_start As Integer
Dim link_end As Integer

Sub Dowload_MerlinData()
    Dim username, password As String
    If WebMerlin.Start_Date.Value = "" Then
    MsgBox ("please select the date")
    Exit Sub
    Else
    Start_Date = WebMerlin.Start_Date.Value
    End If
    
    Application.DisplayAlerts = False
    
     '----------------------Merlin----------------
    'username = InputBox("Enter Username (EIN)", "Login")
    'password = InputBoxDK("Please enter password", "Login")
    Set IE = CreateObject("InternetExplorer.Application")
    IE.Visible = True
    Application.DisplayAlerts = False
    'IE.Navigate "http://ipeipwt7/analytics/"
    
    IE.Navigate "http://merlinng.nat.bt.com/analytics"
    Call ie_busy
    
    If WebMerlin.CntModule.Value <> "Performance Reports" Then
    
    IE.Document.forms("Login").elements(0).Value = "607035481"
    IE.Document.forms("Login").elements(1).Value = "login012"
    
    Else
    
    IE.Document.forms("Login").elements(0).Value = "607035481"
    IE.Document.forms("Login").elements(1).Value = "login012"
    End If
    
    
    IE.Document.forms("Login").submit
    Call ie_busy
    IE.Document.forms("CMA").elements("YES").Click
    
    Application.DisplayAlerts = False
    
    'sendkeys("y", 1)
    
    Call ie_busy
    
    
    Call ie_busy
    'IE.Document.all.tags("A").Item(Tag_Id("Merlin")).Click
    
    IE.Navigate "http://merlinng.nat.bt.com/analytics/saw.dll?Dashboard&_scid=a90Eg3sCSZI&SearchID=il2cvag8lufdvtqpn4abvhatcq&Page=Saturn%20KPI&PortalPath=/shared/Merlin/_portal/Saturn%20Performance&ViewState=i33qi2mv7sfr7ponb7sjsa4q26&StateAction=NewPage&Done=Dashboard"
    
    Call ie_busy
     'IE.Document.all.tags("A").Item(Tag_Id("<CENTER>Merlin")).Click
     'Call ie_busy
     
     If WebMerlin.CntModule.Value = "League Tables" Then
     IE.Document.all.tags("A").Item(Tag_Id("<CENTER>League Tables")).Click
     Call ie_busy
     Call ie_busy
     ElseIf WebMerlin.CntModule.Value = "Performance Reports" Then
     
    IE.Document.all.tags("A").Item(Tag_Id("<CENTER>Performance Reports ")).Click
     Call ie_busy
     
     ElseIf WebMerlin.CntModule.Value = "Login Logout" Then
     
     IE.Document.all.tags("A").Item(Tag_Id("Login Logout")).Click
     Call ie_busy
     
     ElseIf WebMerlin.CntModule.Value = "Offline" Then
     
     IE.Document.all.tags("A").Item(Tag_Id("<CENTER>Offline Reports")).Click
     Call ie_busy
     
     End If
   
   Windows(WebMerlin.Current_data_book).Activate
 '  Call ie_busy
  ' Call fill_hyperlinks
   
   If WebMerlin.CntModule.Value = "League Tables" Then
   Call League_Download
   ElseIf WebMerlin.CntModule.Value = "Login Logout" Then
   Call LoginLogout_Download
   ElseIf WebMerlin.CntModule.Value = "Performance Reports" Then
  ' IE.Document.all.tags("A").Item(124).Click
   'MsgBox ("please click :: Apply Saved selection :: & let the menu populate then click Ok")
   
   
   'Call IE.Document.parentWindow.execScript("buttonMovimenti()", "JavaScript")
   'Call ie_busy
   '<SPAN class=NQWLeftMenuItemArrow><IMG src="res/sk_oracle10/common/menulftarrow.gif" border=0></SPAN><SPAN class=NQWMenuItemText>Apply Saved Selections</SPAN>
   'Call fill_hyperlinks
   Call Performance_Download
   End If
End Sub
 
Upvote 0
What happens if you move the code from ie_busy into the main sub?

Or change it to this and pass the IE object to it.
Code:
Sub ie_busy(IE As ShDocVw.InternetExplorer)
  Do While IE.Busy = True
       DoEvents
    Loop
 
    Do While IE.ReadyState <> 4
       DoEvents
    Loop
    
    Do Until IE.Document.ReadyState = "complete"
       DoEvents
    Loop
End Sub

Called like this.
Code:
ie_busy IE
 
Upvote 0

Forum statistics

Threads
1,216,572
Messages
6,131,488
Members
449,653
Latest member
aurelius33

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