Error Messages/43504
Example error messages
The following error occurred when calling the obj->Add() method using COM: 'The object invoked has disconnected from its clients'
Description
A diverse set of error messages can occur after the colon. In all cases, Windows has reported a problem during a COM method invocation. The method name is given in the error message. In almost all cases, whatever is going on depends on the specifics of the object you are using, how it behaves, and what operations you've performed on it.
Some examples that have been seen are shown below. If you have another, please add it to the list for the sake of future users who might encounter the same.
The object invoked has disconnected from its clients
This means that the COM object that you are calling has terminated execution before the indicated call.
One situation that can result in this case is a call such as the following.
SpreadsheetOpen("Book1.xls")->Worksheets->Add()
The problem here is that workbook returned by SpreadsheetOpen is released after the Worksheets
property returns, because there is no variable holding it. When Analytica releases the workbook returned by SpreadsheetOpen, and if no other application (such as Excel itself) is also holding that workbook object, the workbook is closed. By the time Add()
is called, the underlying workbook has closed so the object disconnects.
Error 0x800a01a8 Object required
This one can also result from a call such as
SpreadsheetOpen("Book1.xls")->Worksheets->Add()
Whether this error, or the previous one (disconnected) occurs is probably a matter of timing. The «workbook» returned from SpreadsheetOpen is released after the call to the Worksheets
property completes. Since this message sometimes occurs, and the previous "object has disconnected" message occurs on other occasions, which message appears probably depends on how far along Excel has gotten on closing the «Workbook» when the Add()
arrives.
In either case, you need to store the result of SpreadsheetOpen in its own variable.
Type mismatch
This one occurs when the data type of a parameter passed to a method is wrong. For example:
ade->OpenModel(123)
produced this error, since OpenModel expects text, rather than a number, for the first parameter.
Invalid number of parameters
You supplied the wrong number of parameters to the method. For example, the method expects two parameters, but you supplied three.
Add method of Sheets class failed
The message was produced by the target application, which happened to be Excel in this case. Although it correctly identified the method that failed, it provided no meaningful information about why it failed. In this case, the method expects no parameters, but one parameter was being supplied.
Enable comment auto-refresher