object invoked has disconnected from its clients

Joined
Feb 8, 2002
Messages
3,381
Office Version
  1. 365
Platform
  1. Windows
Someone just called - their Excel macro is performing very strangely. When they try to delete a row in the worksheet, the row actually deletes, but they get this message:

Automation error
The object invoked has disconnected from its clients.

Upon pressing debug, this row is highlighted:
Sheets(SN(OPS)).Rows(r).Delete Shift:=xlUp

Again the strange thing is that the row *does* actually get deleted.

Any ideas on this message?
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
I realize this thread is very, very old, but I just ran into this problem and wanted to contribute.

Following one of the links provided in the previous post, I followed the Microsoft advice about adding "Option Explicit" to my VBA code and the problem seems to have gone away for good. In my case, the error was occurring when trying to add a text box to a pivot chart in Excel 2007 via macro.

It's too early to tell for certain, but this also seems to have had the side benefit of solving a really weird problem I was having in which chart tabs were renaming themselves from the descriptive names I was giving them to the default names of Chart1, Chart2, etc. I never did find a solution to this other problem via Google searching.
 
Upvote 0
Solution
Option Explicit will help, some of the time. I've added it to my workbook and I get the error less, but it still happens.

In my case, Excel 2007 always crashes when I hit debug, so I never know what line of code is causing the problem.
 
Upvote 0
Thank you! I tried the Option Explicit in my Microsoft Word 2000 and it worked!

I had actually debugged the problem to find that the bug was down to a API Declaration I had made (SetTimer of the user32 library). The message object invoked must have gotten confused when looking for a variable as I added more code elsewhere. Most interesting!
 
Upvote 0

Forum statistics

Threads
1,214,387
Messages
6,119,222
Members
448,877
Latest member
gb24

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