System.Runtime.InteropServices.COMException:此命令不可用,因为没有文档打开

时间:2015-06-28 20:33:15

标签: c# asp.net

我正在使用下面的代码 - 我尝试将Word文档文件保存为.htm。任何人都可以解决这个问题吗?

objWord.Documents.Open(ref FileName, ref readOnly, ref missing, ref missing, 
                       ref missing, ref missing,ref missing, ref missing, 
                       ref missing, ref missing, ref isVisible, ref missing, 
                       ref missing, ref missing,ref missing, ref missing); 
Document oDoc = objWord.ActiveDocument;
oDoc.SaveAs(ref FileToSave, ref fltDocFormat, ref missing, ref missing, 
            ref missing, ref missing, ref missing, ref missing, ref missing,
            ref missing, ref missing, ref missing, ref missing, ref missing,
            ref missing, ref missing);

1 个答案:

答案 0 :(得分:0)

我能够通过在C:\ Windows \ SysWOW64 \ config \ systemprofile \中创建Desktop文件夹来解决问题 和C:\ Windows \ System32 \ config \ systemprofile \