Link to home
Start Free TrialLog in
Avatar of Senz79
Senz79Flag for India

asked on

"Microsoft Office Excel is waiting for another application to complete an OLE action"

Hello All

I am developing an excel automation addin using c# .

When the calculations are on progress i get an prmpt
"Microsoft Office Excel is waiting for another application to complete an OLE action"

I have set
ClsComm.excel.DisplayAlerts = false;

but still it comes back

Please assist me

Senz
Avatar of AnilKumarSharma
AnilKumarSharma
Flag of India image

Check out in your code for waiting/infinite loop.
Avatar of Senz79

ASKER

I hope there is no such loop ... as the whole process takes only 5 mins to complete
Avatar of Miguel Oz
Check that you are not opening another instance of Excel. Only one instance must be working at any time
Avatar of Senz79

ASKER

yes there are two instances of excel, but as its a excel addin how to close the parent excel
Your add-in should be using the same reference to the parent excel.Can you show me how you implement your OnConnect event.

For cleaning com interfaces properly. Please read:
http://stackoverflow.com/questions/166962/release-com-components
good explantion of "Marshal.ReleaseComObject"
http://edndoc.esri.com/arcobjects/9.2/NET/fe9f7423-2100-4c70-8bd6-f4f16d5ce8c0.htm

Basically you need to use Marshal.ReleaseComObject  for every worksheet,workbook and application object when your program finish and then call the garbage collector twice.

In your case after you finsih fixing your code I will restart my PC to avoid Excel instances that have not been released proerly floating around in your system.
Avatar of Senz79

ASKER

Hi
Kindly have a look
senz

Connect.cs
Check:
http://support.microsoft.com/kb/316126
or if your Connect calss exist for the lifetime of your program, please do the following:
Not used:
 public Excel.Application ExcelApp;

You need to surface :
private Excel.Application applicationObject;

Plese add this public method:
public Excel.Application GetApplicationObject()
{
  return applicationObject;
}
Sorry, I have a look at your botton implementation:
What does this code do?
Merge merge = new Merge();
                merge.StartMerge();
If this is your long operation:
How the applicationObject is setup?
I think your constructor need Excel.Application as parameter to assign on a field.
public Merge(Excel.Application app)
{
    applicationObject = app; // applicationObject is a private field of your class
}

Note: You do not need to create a new Excel.Application object, because it will open a second Excel instance. Please resuse the instance defined in Connect class

Avatar of Senz79

ASKER

yes that is my long process
I tried with your idea but i always get object reference not found
when i use the excell object in connect.
ASKER CERTIFIED SOLUTION
Avatar of Miguel Oz
Miguel Oz
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Senz79

ASKER

okay i will follow ur instruction and get back asap
I provided a solution, but unfortunately Senz79 did not provide any answer... as he needs to provide feedback from the debugger information that I requested.

It is shame that our time is being wasted with no consideration ....
Avatar of Senz79

ASKER

Kindly delete the data in the question on priority.Due to some security issue