Microsoft KB Archive/285436

= Incorrect VBA view type returned for Slide Master View in PowerPoint =

Article ID: 285436

Article Last Modified on 1/29/2007

-

APPLIES TO


 * Microsoft Office PowerPoint 2007
 * Microsoft Office PowerPoint 2003
 * Microsoft PowerPoint 2002 Standard Edition

-



This article was previously published under Q285436



SYMPTOMS
When you use a Microsoft Visual Basic for Applications (VBA) macro in Microsoft PowerPoint to determine the current view type, the results for a slide master may incorrectly indicate a Normal view.



CAUSE
This behavior occurs because of the way that the ActiveWindow.View.Type property handles all views that have multiple panes. For all views that have multiple panes, ActiveWindow.View.Type returns ppViewNormal, or a value of 9.



RESOLUTION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. NOTE: The following macro examples work only in PowerPoint. Visual Basic for Applications macros are not supported by the Microsoft PowerPoint Viewer. For additional information, click the following article number to view the article in the Microsoft Knowledge Base: The following sample macro allows you to determine which view PowerPoint is currently in: Sub DisplayViewType Dim typCurrentViewType As PpViewType Dim strCurrentViewType As String '  ' First determine if the current view is the Normal View. '  If Application.ActiveWindow.View.Type = ppViewNormal Then '  ' If it is, then the second item in the Panes collection ' will be the actual view we wish to return a value on. '     typCurrentViewType = ActiveWindow.Panes.Item(2).ViewType Else '  ' If it is not, then return the ViewType for the active ' window. '     typCurrentViewType = Application.ActiveWindow.View.Type End If  ' ' Based on the view type, assign the corresponding ' description to the string variable. '  Select Case typCurrentViewType Case ppViewSlide strCurrentViewType = &quot;Slide&quot; Case ppViewSlideMaster strCurrentViewType = &quot;Slide Master&quot; Case ppViewNotesPage strCurrentViewType = &quot;Notes Page&quot; Case ppViewHandoutMaster strCurrentViewType = &quot;Handout Master&quot; Case ppViewNotesMaster strCurrentViewType = &quot;Notes Master&quot; Case ppViewOutline strCurrentViewType = &quot;Outline&quot; Case ppViewSlideSorter strCurrentViewType = &quot;Slide Sorter&quot; Case ppViewTitleMaster strCurrentViewType = &quot;Title Master&quot; Case ppViewNormal strCurrentViewType = &quot;Normal&quot; Case ppViewPrintPreview strCurrentViewType = &quot;Print Preview&quot; Case ppViewThumbnails strCurrentViewType = &quot;Thumbnails&quot; Case ppViewMasterThumbnails strCurrentViewType = &quot;Thumbnails Master&quot; End Select '  ' Display the ViewType value. '  MsgBox strCurrentViewType & &quot; View&quot; End Sub

Additional query words: PPT2007 PPT2003 PPT prb PPT2002

Keywords: kbpending kbprb KB285436

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.