如何停止“自动打开"通过com打开文档文件时发生的事件 [英] how to stop the "autoopen" event when opening a doc file through com

查看:65
本文介绍了如何停止“自动打开"通过com打开文档文件时发生的事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要通过以下方式打开doc文件;

I want to open a doc file by the way as follows;

_Application wApp;
wApp.CreateDispatch(L"Word.Application");
Documents wDocs = wApp.GetDocuments();
COleVariant vNotFind(DISP_E_PARAMNOTFOUND, VT_ERROR);
_Document wDoc = wDocs.Open(COleVariant("...doc"), vNotFind,vNotFind,vNotFind,vNotFind,vNotFind,vNotFind,vNotFind,vNotFind,vNotFind,vNotFind,vNotFind,vNotFind,vNotFind,vNotFind,vNotFind);



但是当转到"wDocs.Open("时,将运行doc文件中的以下宏.



But when it goes to "wDocs.Open(", the macro as follows in doc file will run.

Sub autoopen()<br />
MsgBox "hello"<br />
End Sub



如何停止?



how to stop it?
My english is just-so-so, so forgive me.

推荐答案

您的英语没有背叛您;我的英语没什么大不了的.我希望其他查询者能写得这么清楚清楚.

关闭宏处理非常重要,因为宏是危险的功能.我检查了我的Word安装;默认情况下,它使用禁用除受信任位置之外的宏"之类的选项,并且受信任位置仅是由Word安装创建的位置,而不是我通常可以在其中复制文档的位置.

因此,也就是说,您应该在Word设置中注意这一点.该过程取决于您的Word版本.在您的帮助中检查或搜索禁用宏".在较新的版本中,它是通过字设置"完成的. 信任中心".

例如:
http://office.microsoft. com/en-us/word-help/enable-or-disable-macros-in-office-documents-HA010031071.aspx [ http://office.microsoft. com/en-us/word-help/enable-or-disable-macros-in-office-files-HA010354316.aspx [ http://www.thuto.org/ubh/ub/com//hcsmsw1. htm [ ^ ].

保持安全,
—SA
Your English did not betray you; I wish other inquirers could write so correctly and clearly.

It is very important to switch off macro processing, because macro is dangerous feature. I checked my Word installation; it is using by default the option like "disable macros except trusted locations", and the trusted locations are only those created by the Word installation, not where I can normally copy the document.

So, that said, you should take care about it in the Word settings. The procedure depends on your Word version. Check or search for "disable macros" in your help. In newer versions it''s done via "Word Settings" -> "Trust Center".

For example:
http://office.microsoft.com/en-us/word-help/enable-or-disable-macros-in-office-documents-HA010031071.aspx[^],
http://office.microsoft.com/en-us/word-help/enable-or-disable-macros-in-office-files-HA010354316.aspx[^].

See also (for older versions): "How to switch off bad features of MS Word
and other Windows problems", http://www.thuto.org/ubh/ub/compu/hcsmsw1.htm[^].

Keep it safe,
—SA


这篇关于如何停止“自动打开"通过com打开文档文件时发生的事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆