Using ComObj plugin

I am having problems using Ole Automation within a script. I have included the ComObj Plugin. When I call GetActiveOleObject, it always creates a new instance of the application?
According to the documentation for automation, it says to call that to see if there is an instance of the program allready running. When I call it, it always creates a new instance of Excel, even if there is one allready ?

Here is a snippet of the script…

function DoExcel(var oSheet:Variant): integer;
var oXL, oWB, oRng, VArray : Variant;
begin
try
oXL := GetActiveOleObject(‘Excel.Application’);
except
try
oXL := CreateOleObject(‘Excel.Application’);
except
TC.print(‘Error CreatingOleObject’);
Exit;
end;
end;

It never gets an exception from GetActiveOleObject ? and it creates a new instance of excel ?>

Thanks,
Ken

This is a more generic Ole issue. We just call the delphi GetActiveOleObject api here. There are lots of reasons why GetActiveOleObject returns a new object instead of the existing one. Usually because of user rights (like UAC).

I turned off UAC and it still happens?
I noticed that the first time I run the script and it calls GetActiveOleObject and excel isn’t running, it fails with an exception and then CreateOleObject is called then it creates an instance of Excel. However, the next time I run the script and Excel is running, GetActiveOleObject doesn’t fail, but creates a new instance of Excel anyway?

I have searched and can’t find any info about this problem?
What other things should I try ?

Thanks,
Ken

I have no idea. My experience with Excel as OLE objects is very limited.