Search code examples
c#.netvstopowerpointpowerpoint-2010

Open a powerpoint presentation and hide the window


I am trying to open a PowerPoint presentation, and have it hidden. I am doing it this way:

app = new Microsoft.Office.Interop.PowerPoint.Application();
string presentation = "C:\\presentation.pptx";

Presentation p = app.Presentations.Open(presentation, MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoFalse);

It is the simplest thing, yet I receive an error saying:

Application (unknown member) : Invalid request. There is no active presentation.

However, if I switch the last parameter (which is the WithWindow parameter) to MsoTriState.msoTrue, the presentation opens fine.


Solution

  • Do you have any other add-ins that might be causing that error? I ran your code (from VBA) and it ran fine.