Click here to Skip to main content
13,142,182 members (54,034 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
Hi Guys,

Can anyone please help me in get rid of this error. I have an application which will generate offer letter in word format. When there are many winword process opened in the server i am getting error message "the message filter indicated that the application is busy rpc_e_servercall_retrylater".

Is there any way to prevent this error message occuring.

I am using c# language to develop the code.


Here is my code for opening & closing word document.

public WordTemplate()
{
objWApp = new Word.ApplicationClass();
}

public void OpenWord()
{
try
{
object objMissingValue = System.Reflection.Missing.Value;
objDoc = objWApp.Documents.Add(ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue);
objDoc.Activate();
}
catch (Exception ex)
{
throw ex;
}
}

public void OpenWord(string strFileName)
{
try
{
object objMissingValue = System.Reflection.Missing.Value;
object objFileName = strFileName;
object objIsReadOnly = false;
object objIsVisible = true;
objDoc = objWApp.Documents.Open(ref objFileName, ref objMissingValue, ref objIsReadOnly, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objIsVisible, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue);
//objDoc = objWApp.Documents.Open(ref objFileName, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue);
objDoc.Activate();
}
catch (Exception ex)
{
throw ex;
}
}
public void Close()
{
try
{
object objMissingValue = System.Reflection.Missing.Value;
objWApp.Quit(ref objMissingValue, ref objMissingValue, ref objMissingValue);

}
catch (Exception ex)
{
throw ex;
}
finally
{
objDoc = null;
objWApp = null;
GC.Collect();
GC.WaitForPendingFinalizers();
}
}


Thanks,
Prashant
Posted 21-Feb-13 16:04pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web01 | 2.8.170915.1 | Last Updated 21 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100