Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Error "The object invoked has disconnected from its clients." when setting RowHeight using Excel OLE Automation

Posted on 2005-03-24
8
Medium Priority
?
325 Views
Last Modified: 2010-05-02
I have a VB 6.0 project that contains code to generate an Excel report.  The report has been working well for a long time; however, I am now getting the following error:

The object invoked has disconnected from its clients.
err.number = -2147417848

The line kicking the error reads:

oSheet.Rows("3:3").RowHeight = 77.25

Where oSheet is declared as follows:

Set oXL = CreateObject("Excel.Application")
Set oBook = oXL.Workbooks.Add()
Set oSheet = oBook.Sheets(1)

This is a showstopper.  If anyone has any ideas I would be greatly appreciative.
0
Comment
Question by:tlchavet
7 Comments
 
LVL 12

Expert Comment

by:gbzhhu
ID: 13624022
Is Excel installed locally or are you accessing via LAN?

Is the line that bombs tyhe first  line thgat uses the oSheet object call?

Does it always bomb at that line?
0
 
LVL 1

Author Comment

by:tlchavet
ID: 13624107
Excel is installed locally.

This is not the first call to oSheet.  There are a bunch of column width sets first.

Yes, it always bombs at that line.
0
 
LVL 38

Expert Comment

by:PaulHews
ID: 13624307
Doesn't look like this:
http://support.microsoft.com/default.aspx?scid=kb;en-us;813120

It's late bound so it shouldn't be this:
http://support.microsoft.com/default.aspx?scid=kb;en-us;319832

Unless you have a reference to Excel in your project as well... If you do try removing it and recompiling.

More information on the code that precedes the error may help


0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 10

Expert Comment

by:edwardiii
ID: 13625891
Hi, tlchavet.

I've gotten that error when my ADO connection object has been shut down and an attempt is made to read from/write to my db.  It's likely that at the point in your code where you get the error, something is causing either your oXL, oBook, or oSheet objects to shut down.  If you scan all code in your application for the code you use to disconnect/shut down any of these objects (e.g. "= nothing", "quit", etc.), you may find the code that is unloading your object.  Barring that, what happens if you rem out the code that crashes your app (e.g. "oSheet.Rows("3:3").RowHeight = 77.25
")?  If the very next line of code bombs out during your next run, it's likely the error is caused just prior to that line.  If your app runs fine after remming out, then we need to look at your Excel sheet's code at 3:3.
0
 
LVL 1

Author Comment

by:tlchavet
ID: 13626382
If I resume next after the error, the rest of the report runs fine.
0
 
LVL 1

Author Comment

by:tlchavet
ID: 14365312
This one can be closed with no solution.
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 14395797
PAQed with points refunded (500)

modulo
Community Support Moderator
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question