Search code examples
vb.netinteroppowerpoint-2007

Powerpoint Interop API access multiple slide masters inside slide master view


I have powerpoint presentation with multiple master slides.I want to access current active powerpoint presentation slide master in master view using InterOp API and VB.net. When I tried to access active slide master it always select the first slide master instead of active master slide.I tried it with slides and I could access current slide.But in slideMaster view I couldn't find way to access specified slide master.

If(ActiveWindow.ActivePane.ViewType = PowerPoint.PpViewType.ppViewSlideMaster) Then 'condition 

ActivePresentation.Slides(2) 'this way I can access specified slide.
ActivePresentation.SlideMaster 

Solution

  • If by "active slide master" you mean the slide master used by the currently selected slide you can access it via

    ActiveWindow.Selection.SlideRange(1).Design.SlideMaster
    

    Or likewise for the master of the first slide in the presentation

    ActivePresentation.Slides(1).Design.SlideMaster
    

    Or in slide master view

    If ActiveWindow.ActivePane.ViewType = ppViewMasterThumbnails Or _
        ActiveWindow.ActivePane.ViewType = ppViewSlideMaster Then
    
        ActiveWindow.View.Slide...
    End If