Share via

Application.ActiveWindow.ViewType not working right

Anonymous
2016-12-22T03:56:37+00:00

Why does this code in VSTO rerun a 9 (ppViewnormal) instead of a 7 (PpViewType.ppViewMasterThumbnails) even though it is in MasterThumbnails view

      Globals.ThisAddIn.Application.ActiveWindow.ViewType = PpViewType.ppViewMasterThumbnails

        MsgBox(Globals.ThisAddIn.Application.ActiveWindow.ViewType)

Same in VBA

    Application.ActiveWindow.ViewType = PpViewType.ppViewMasterThumbnails

    MsgBox (Application.ActiveWindow.ViewType)

If I substitute Windows(1) for  ActiveWindow same thing

my macro will not work in slidemaster mode and I want to test if the software is in that mode before proceeding

Microsoft 365 and Office | PowerPoint | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2016-12-22T09:03:21+00:00

If you are in slidemaster view viewtype always returns 9 (incorrectly)

Something like this might tell you which view you are in

   If ActiveWindow.ViewType = 9 Then

      If ActiveWindow.Panes(2).ViewType = ppViewSlideMaster Then

         MsgBox "You are in Slide Master View. Please switch to Normal View.", vbExclamation, strMBTitle

         Exit Sub

      End If

   End If

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2017-04-10T03:15:14+00:00

    Based on John answer I wrote this (VBA) which I found was useful

    Sub WhatViewPanesAreOpen()

        Dim opn    As Pane

        Dim cnt    As Integer

        cnt = 0

        Debug.Print "Pane Count = " & ActiveWindow.Panes.Count

        For Each opn In ActiveWindow.Panes

            cnt = cnt + 1

            'Debug.Print opn.ViewType

            Select Case opn.ViewType

                Case 1

                    Debug.Print " Pane " & cnt; " =  ppViewSlide (1)"

                Case 2

                    Debug.Print " Pane " & cnt; " =  ppViewSlideMaster (2)"

                Case 3

                    Debug.Print " Pane " & cnt; " =  ppViewNotesPage (3)"

                Case 4

                    Debug.Print " Pane " & cnt; " =  ppViewHandoutMaster (4)"

                Case 5

                    Debug.Print " Pane " & cnt; " =  ppViewNotesMaster (5)"

                Case 6

                    Debug.Print " Pane " & cnt; " =  ppViewOutline (6)"

                Case 7

                    Debug.Print " Pane " & cnt; " =  ppViewSlideSorter (7)"

                Case 8

                    Debug.Print " Pane " & cnt; " =  ppViewTitleMaster (8)"

                Case 9

                    Debug.Print " Pane " & cnt; " =  ppViewNormal (9)"

                Case 10

                    Debug.Print " Pane " & cnt; " =  ppViewPrintPreview (10)"

                Case 11

                    Debug.Print " Pane " & cnt; " =  ppViewThumbnails (11)"

                Case 12

                    Debug.Print " Pane " & cnt; " =  ppViewMasterThumbnails (12)"

            End Select

        Next

    End Sub

    Was this answer helpful?

    0 comments No comments