Kumaran T
Kumaran T

Reputation: 677

how to disable macro in word document before opening it

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 opening the word document programatically

help me to overcome the problem

Upvotes: 2

Views: 3354

Answers (1)

Steven
Steven

Reputation: 343

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

Upvotes: 2

Related Questions