0

I am using Microsoft.Office.Interop to open publisher from c# code. The issue is that unlike other office apps it does not provide the option to stop display alerts. Is there a way around this or a reason?

This is the way it is used for Word / Excel:

Microsoft.Office.Interop.[OFFICE_APP].Application app = new Microsoft.Office.Interop.[OFFICE_APP].Application();
app.DisplayAlerts = false;
Johnathan
  • 49
  • 7

1 Answers1

0

You are correct that there is no option to disable alerts. What alert exactly is it that you need to supress?

For instance, if your Publisher file contains macros, you can avoid the warning regarding macros by setting Application.AutomationSecurity (https://msdn.microsoft.com/EN-US/library/office/ff939580.aspx) to msoAutomationSecurityForceDisable (https://msdn.microsoft.com/en-us/library/microsoft.office.core.msoautomationsecurity.aspx). This is the only alert I've ever needed to supress personally, but I'd be interested to know if you've run into another one.

I'm not sure whether there is a reason, but there are many discrepancies between the different object models in Microsoft Office, so perhaps you simply shouldn't expect it to work the same. For example, Excel doesn't have any Tags collection, whereas Publisher and Word do, but they're implemented quite differently.

Jbjstam
  • 874
  • 6
  • 13