Article ID: 161485
Article Last Modified on 10/11/2006
Sub FollowMaster()
' Declare the variables.
Dim OmitSlides() As String, Message As String
Dim Index As Long, Count As Long, NumSlides As Long
Dim CurrentSlide as Slide
Dim Flag As Boolean
' Used to control the loop.
Dim j As Long
' Initialize the index and flag.
Index = -1
Flag = False
' Get the number of slides.
NumSlides = ActivePresentation.Slides.Count
' Loop through the slides.
For j = 1 To NumSlides
Set CurrentSlide = ActivePresentation.Slides(j)
' Check to see whether slide is different from master.
If CurrentSlide.DisplayMasterShapes = msoFalse Or _
CurrentSlide.FollowMasterBackground = msoFalse Then
' Add the slide number to an array.
Index = Index + 1
ReDim Preserve OmitSlides(Index)
OmitSlides(Index) = j
' Set the flag to True if one slide is not following the
' master.
If Flag = False Then
Flag = True
End If
End If
Next j
' Display the results.
If Flag = False Then
MsgBox "All slides are following the master.", vbInformation
Else
' Start building message for the message box.
If Index < 1 Then
Message = "The following slide is NOT following the Master:" _
& Chr(13)
Else
Message = "The following " & Index + 1 & " slides are NOT " _
& "following the Master:" & Chr(13)
End If
' Loop until slides finished.
For j = 0 To Index
Message = Message & Chr(13) & Chr(9) & "Slide #" & _
OmitSlides(j)
Next j
' Display the completed message box.
MsgBox Message, vbInformation
End If
End Sub
176476 OFF: Office Assistant Not Answering Visual Basic Questions
163435 VBA: Programming Resources for Visual Basic for Applications
Additional query words: 97 8.00 kbmacro ppt8 vba vbe template differ omit background color colour macppt mac_ppt ppt98 98 powerpt
Keywords: kbcode kbdtacode kbhowto kbmacro kbprogramming KB161485