コンピュータや音楽の事書いてます

メモ: LINQは便利

using System.Linq;
using PowerPoint = Microsoft.Office.Interop.PowerPoint;

PowerPoint.Presentation pres = /* 何かのパワポのファイル */;
pres.Windows.OfType<PowerPoint.DocumentWindow>()
    .Where(w => w.ViewType == PowerPoint.PpViewType.ppViewNormal)
    .ElementAt(0).Panes.AsQueryable().OfType<PowerPoint.Pane>()
    .Where(p => p.ViewType == PowerPoint.PpViewType.ppViewSlide)
    .ElementAt(0).Activate();

意味:
プレゼンテーションのWindowsの中からDocumentWindow型の物を抜き出し、
その中からViewTypeがppViewNormalの物を抜き出し、
その0番目のPanesの中から、Pane型の物を抜き出し、
その中からViewTypeがppViewSlideの物を抜き出し、
その0番目をActivateする