1
我需要在Word中禁用SaveAs或防止用户更改文件名。在Word中禁用SaveAs
我的应用程序允许用户使用头文件我为它们提供程序创建一个MailMerge文档。当用户只是简单地保存并退出Word时,此功能就可以工作。如果用户另存为,应用程序将被锁定。我正在使用Microsoft.Office.Interop.Word
。
//MyWordApp & doc is initialized.
MyWordApp.Application.Visible = true;
While(WordIsOpen())//Holds execution here while User is editing in Word
{
}
WordIsOpen定义:
public bool WordIsOpen()
{
if (MyWordApp.Application.Visible)//Locks up here
{
return true;
}
else
return false;
}
禁售:
//I have a BeforeSave event that Saves the doc and quits Word
DocumentBeforeSave(Doc, SaveAsUI, Cancel)
{
//Save Doc
MyWordApp.Quit(ref objFalse, ref objNull, ref objNull);//Also, Locks up here
}
为什么不修复它,使应用程序不锁定? – Ghost 2012-07-16 20:10:58
确定为什么应用程序锁定并解决该问题不是更有意义吗? – CaffGeek 2012-07-16 20:11:05
我试过修复它。我改变了我一直在做的方式。走完整个圈子,最后回到你在这里看到的方法。 – ExceptionLimeCat 2012-07-16 20:39:17