I'm trying to make a .net 4.0 program which will get the filename of a PowerPoint Show (PPS) that is being viewed on the same machine. The purpose is to time how long a particular presentation takes to go through without any user action.
I've tried the following:
oPPTApp = (PowerPoint.Application)System.Runtime.InteropServices.Marshal.
GetActiveObject("PowerPoint.Application");
string ppsname = oPPTApp.ActivePresentation.Name.ToLower();
The program runs minimized while the presentation is being viewed. Even while interacting with the PPS (scrolling through slides, clicking, etc), I get the following error from Microsoft.Office.Interop.PowerPoint._Application:
Application (unknown member) : Invalid request. There is no active presentation.
After searching through http://support.microsoft.com/kb/285472, I tried adding:
oPPTApp.Visible = Microsoft.Office.Core.MsoTriState.msoTrue;
However, this started a new instance of PowerPoint, followed by the same error.
I'll also mention I'm using Microsoft PowerPoint 14.0 Object Library and the IOleMessageFilter error handler from here: http://msdn.microsoft.com/en-us/library/vstudio/ms228772(v=vs.110).aspx
Does ActivePresentation.Name not apply to PPS files? Is there a better way of getting the filename of an open PPS?