0

I want to start PowerPoint instance, add a presentation to it in a way that has its window hidden (either a new one or existing one, both result in the same issue). However, I get run-time error in PowerPoint that says: Application (unknown-member): Invalid request. There is no active presentation.

When a window is visible or there is already a PowerPoint instance open with at least one presentation it works without a problem. Moreover, when I click "End" in this Run-time error it correctly creates a presentation anyway. I tried using both NetOffice wrapper and Interop itself.

I'm using Office 2016 32-bit.

var app = new Application();
var ppt = app.Presentations.Add(Microsoft.Office.Core.MsoTriState.msoFalse);
// Or using NetOffice, which basically uses different namespaces
var netApp = new PowerPoint.Application();
var netPPt = netApp.Presentations.Add(MsoTriState.msoFalse);

I would like to be able to add presentation to the hidden window, as withnetApp.Presentations.Add(MsoTriState.msoTrue) it works just fine.

Alexander van Oostenrijk
  • 4,644
  • 3
  • 23
  • 37
blaz11
  • 23
  • 1
  • 7

1 Answers1

2

For powerpoint 2000 onwards, the application must be visible. You can enable this by using the following

if (app.Version >= 9)
{
    app.Visible = Microsoft.Office.Core.MsoTriState.msoTrue;
}

See this article for further details:

https://support.microsoft.com/en-us/help/285472/run-time-error-2147188160-on-activewindow-or-activepresentation-call-i

Droxx
  • 197
  • 1
  • 8