打开Word文档时发生错误 [英] An error occurs when open Word document
本文介绍了打开Word文档时发生错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好.
我有示例代码:
Hello.
I have sample code:
void myFunc()
{
string UID = "Word.Application";
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
Type appType = Type.GetTypeFromProgID(UID);
if (appType == null) return;
objApp = Activator.CreateInstance(appType);
objApp.GetType().InvokeMember("Quit", BindingFlags.InvokeMethod, null, objApp, null);
}
尝试关闭objApp时发生错误.我在这里http://support.microsoft.com/kb/827732/en-us
阅读
(简短地-打开Word文档时,模板宏中会出现一个对话框窗口)
我可以阻止显示此对话框吗?或如何以编程方式关闭它?
我尝试:
Whe objApp try to close an error is occured. I read about it here http://support.microsoft.com/kb/827732/en-us
(Shortly - when Word document is opened a dialog window appeares from template macro)
I can i prevent to show this dialog? Or How can i close it programmatically?
I try :
SendKeys.Send("{ESC}");
>
but it does not always work.
推荐答案
保存word文档的内容后,可以使用
关闭线程
After saving the content of word document, you can close thread using
Thread.Abort()
这是一种疯狂的方式;但最后一个选择.
Itz a wild way; but last option.
U必须更改Microsoft Office文档中的安全设置
U Have to change security settings in Microsoft Office documents
这篇关于打开Word文档时发生错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文