I have a addin in word that on startup tries to use some macros (I presume that's what it's trying to do anyway), and pops up a window that looks similar to
I think the issue is that the addin has an expired digital signature, however, I require this addin to be installed and it can't be updated.
Is there any way to disable the macros, or the addin for this word instance, automatically so that I don't see the popup and my program can run without any user interaction?
So far I've tried disabling alerts, making it not visible, disabling screen update, and setting the automation to force disabled
Application word = new Application()
{
DisplayAlerts = WdAlertLevel.wdAlertsNone,
ScreenUpdating = false,
Visible = false,
AutomationSecurity = MsoAutomationSecurity.msoAutomationSecurityForceDisable,
};
However, it doesn't seem to work for MS Word 2016 (the version I have to use) as the popup still seems to appear when I run my program.
Note: Whilst I require the addin to be installed and it can't be updated, no addins are required for this program run at all
NuGets for Example:
- Install-Package MicrosoftOfficeCore -Version 15.0.0
- Install-Package Microsoft.Office.Interop.Word -Version 15.0.4797.1003
.NET 6 Console Example:
using Microsoft.Office.Core;
using Microsoft.Office.Interop.Word;
Console.WriteLine("Opening Word");
Application word = new Application()
{
DisplayAlerts = WdAlertLevel.wdAlertsNone,
ScreenUpdating = false,
Visible = false,
AutomationSecurity = MsoAutomationSecurity.msoAutomationSecurityForceDisable,
};
// Popup happens here, prevents execution of remaining code until user has enabled / disabled the macros
Console.WriteLine("Closing Word");
word.Quit();