I have a really annoying problem.
I am openign a word document via c# / COM Interop (Word 2007). I want to prevent the Macros from Running as some of them may crash (older files with missing bookmarks etc.).
So I run the following code to suppress all the dialogs that may pop up:
Word.ApplicationClass wordApplication = new Word.ApplicationClass();
wordApplication.DisplayAlerts = Word.WdAlertLevel.wdAlertsNone;
wordApplication.ShowVisualBasicEditor = false;
wordApplication.AutomationSecurity =
Microsoft.Office.Core.MsoAutomationSecurity.msoAutomationSecurityForceDisable;
Word.Document wordDoc = null;
When I then execute the following code, I get the message box "Macros in this Project are Disabled".
wordDoc = wordApplication.Documents.Open(
ref paramSourceDocPath, ref paramMissing, ref paramMissing,
ref paramMissing, ref paramMissing, ref paramMissing,
ref paramMissing, ref paramMissing, ref paramMissing,
ref paramMissing, ref paramMissing, ref paramMissing,
ref paramMissing, ref paramMissing, ref paramMissing,
ref paramMissing);
I need to either suppress this message, dettect if it is being shown and "ok" it or find a way of disableing startup macros without VB getting in the way.
Any Ideas?