Call Rejected By Callee UNLESS...


I have an OLE automation app which works fine on some computers and on
others gets the dreaded "Call Rejected By Callee". I've matched the OS
and Excel version of one of these computers up to one where the app
works but still get the error--unless!

Unless Excel is already running! So, I'm trying to figure out if
there's anything the way I'm activating the thing that's causing the

procedure TForm1.FormCreate(Sender: TObject);
var V: OleVariant;
   XLC.CreateObjectFromFile(ExtractFileDir(ParamStr(0)) +
'\sample.xls', False);
   XLWBSheetActivate(nil, V);
   lcid := GetUserDefaultLCID;

ActivateOLE turns off all the command bars and dynamically creates a
main menu for the form (thus eliminating the Excel menus), but I get
the "Call rejected" error before it gets that far, so I don't think the
problem is there.

   I'm thinking of adding cdoe to explicitly starting Excel (and maybe
shut it down right after) to get around the problem but would like
suggestions for "neater" solutions.


Sent via
Before you buy.