Search code examples
c#interopoffice-interopms-project

disabling overwrite existing file prompt in Microsoft office interop FileSaveAs method


I am using Ms Office Interop assemblies to create a MS Project file. To save the file created, I am using FileSaveAs method and it prompts a message saying that if you want to replace the existing file. I want to suppress the message, and I didn't find any parameter in FileSaveAs method for this purpose. Any Idea on this? I'am using C# as my programming language.


Solution

  • I ran into this issue when working with Excel Interop. The best I've been able to find is to disable all Office alerts, like this:

    Microsoft.Office.Interop.MSProject.Application msProjectApp = new Microsoft.Office.Interop.MSProject.Application();
    msProjectApp.DisplayAlerts = false;