i am programmatically opening the word document to do some process automatically without manual intervention. in some word document there are macro (such as showing message box while opening). while opening the document it show the message box and user need manual intervention to continue the process. so i need to disable the macro before ope开发者_Python百科ning the word document programatically
help me to overcome the problem
I haven't tried it for myself, but I think the application.AutomationSecurity = Microsoft.Office.Core.MsoAutomationSecurity.msoAutomationSecurityForceDisable
should disable all macros from being executed. Also, you might achieve what you want with setting the DisplayAlerts property:
application.DisplayAlerts = Word.WdAlertLevel.wdAlertsNone
精彩评论