开发者

Attach to an open instance of Power Point

I am writing a simple module that uses Microsoft.Office.Interop.PowerPoint to determine if a PowerPoint slideshow is active and if so which slide is currently being presented. This works great when I use Microsoft.Office.Interop.PowerPoint.Presentation to open t开发者_开发知识库he presentation in my code. If possible, I want to check to see if an instance of Power Point is already open and if so attach to it instead of opening a new instance.

TIA


Create a new Interop.PowerPoint.Application and check whether your file is in the Presentations collection.

Unlike Word or Excel, PowerPoint is a single-instance application; your new Application instance will automatically connect to any open copy of PowerPoint.


you can check by calling Marshal.GetActiveObject ("Powerpoint.Application") - it gives an exception if powerpoint is not running... see http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.marshal.getactiveobject.aspx

If it is running this gives you an object...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜