none
Microsoft Word 12.0 Object Library throws oDoc.SaveAs() "The message filter indicated that the application is busy." RRS feed

  • Question

  • In our web application VS 2008, When I try to convert an Office 2003 file to Office 2007 file format, am getting the following exception In the oDoc.SaveAs() statement. What might be the reason! we are using Microsoft Word 12.0 Object Library and Microsoft Excel 12.0 Object Library.
    The message filter indicated that the application is busy. (Exception from HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER))

    Have the following code :-
     public static string ConvertDocToDocx(object sourceDocFilePath, object destinationDocxFilePath)
            {
                object omissing = System.Reflection.Missing.Value;
                Word._Application oWord = GetWordApplicationInstance();
                Word._Document oDoc;
                oDoc = oWord.Documents.Open(ref sourceDocFilePath, ref omissing, ref omissing, ref omissing, ref omissing, ref omissing, ref omissing, ref omissing, ref omissing, ref omissing, ref omissing, ref omissing, ref omissing, ref omissing, ref omissing, ref omissing);
                object frmt = Word.WdSaveFormat.wdFormatXMLDocument;//Foramt meant for Office 2003.
                oDoc.SaveAs(ref destinationDocxFilePath, ref frmt, ref omissing, ref omissing, ref omissing, ref omissing, ref omissing, ref omissing, ref omissing, ref omissing, ref omissing, ref omissing, ref omissing, ref omissing, ref omissing, ref omissing);
                oDoc.Close(ref omissing, ref omissing, ref omissing);
                return (string)destinationDocxFilePath;
            }

    private static Word.Application GetWordApplicationInstance()
            {
                Word.Application oWord = null;
                try
                {
                    oWord = (Microsoft.Office.Interop.Word.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Word.Application");
                }
                catch (Exception)
                {
                    oWord = null;
                }
                if (oWord == null)
                {
                    oWord = new Word.Application();
                    oWord.Visible = false;
                }
                return oWord;
            }


    Thanks,
    Manjunath.


    manjunath
    Wednesday, July 1, 2009 1:44 PM

Answers