使用模板和书签将数据库中的数据库导出为word文档,但是总是提示如下错误
“此文件正由另一应用程序或用户使用(D:\Documents and Settings\....\Normal.dot)”
找不到原因,麻烦各位高手帮我看看吧,谢谢~~~

解决方案 »

  1.   

    word——工具——模板——选用——删掉一个,然后取消“自动更新模板“
      

  2.   

    只有一个Normal.dot,本来就没有点选“自动更新模板”,而且在前面提到的错误提示“此文件正由另一应用程序或用户使用(D:\Documents and Settings\....\Normal.dot)”中,点击“确定”,会弹出“另存为”对话框……
      

  3.   

    Word程序运行的时候,只能开一个主程序。在非编程人员使用的时候,不会出现一个系统中同时开两个Word的情况,但是程序员用c#,或vba操作Word的时,很有可能会用一个Word.Application wordApp = new Microsoft.Office.Interop.Word.Application();就新建了一个Word程序,这样下去如果不关掉新建的Word程序,久而久之,就会出现系统中开启了若干个Word程序的情况,这时候关闭Word就会出现问你是否要保存Word默认模版的问题,因为开一个Word时,关闭Word那关闭了就行了没说的。若是有多个Word要关闭,那么就会出现到底要不要更改Word模版的问题,因为关闭了之后,还有其他的Word程序,而所有的Word程序是通用了一个模版,所以,应该问一下使用者:当前的模版要修改吗?  这只是我的推测,不是什么答案。 
    想安静的关闭Word的方法是调用一个函数: 
    用 
                    doc.Close(ref Nothing, ref Nothing, ref Nothing); 
                    wordApp.Quit(ref Nothing, ref Nothing, ref Nothing); 
                    try 
                    { 
                        if (doc != null) 
                        { 
                            Marshal.ReleaseComObject(doc); 
                            doc = null; 
                        } 
                        wordApp.Quit(ref Nothing, ref Nothing, ref Nothing); 
                    } 
                    catch 
                    { 
                        try 
                        { 
                            if (wordApp != null) 
                            { 
                                Marshal.ReleaseComObject(wordApp); 
                                wordApp = null; 
                            } 
                        } 
                        catch (Exception ex1) 
                        { 
                            MessageBox.Show(ex1.ToString()); 
                        }                 } 
      

  4.   

    再参考这个
    http://support.microsoft.com/kb/285885/zh-cn的解决方案,虽然是vb的,但可以看出c#的解决方案:用下面的方法 
    object saveOption = Word.WdSaveOptions.wdDoNotSaveChanges; 
    wordApp.Quit(ref saveOption, ref Missing, ref Missing); 
    而不是 
    wordApp.Quit(ref Missing, ref Missing, ref Missing);
      

  5.   


    这个我试过了,确实是不弹对话框了,但是他一点儿反应都没有,要想导出的word如何另存呢?
      

  6.   

    http://www.gz183.com.cn/Info/133/info31074_1.htm http://blog.csdn.net/lovexiaoxiao/archive/2008/12/26/3613400.aspx
      

  7.   

    楼主可不可以共享一下代码[[email protected]][/email]
      

  8.   

    wordApp.Quit(ref Nothing, ref Nothing, ref Nothing);
     把 这一句 注释掉  试试看