共用方式為


PowerPoint) (Application.SlideShowNextSlide 事件

會剛好在切換到下一張投影片之前發生。 如果是第一張投影片,則會在 SlideShowBegin 事件之後立即發生。

語法

expressionSlideShowNextSlide (Wn)

表達 會傳回 Application 物件的運算式。

參數

名稱 必要/選用 資料類型 描述
Wn 必要 SlideShowWindow 使用中的投影片放映視窗。

註解

如需搭配 Application 物件使用事件的詳細資訊,請參閱操作方法:搭配 Application 物件使用事件

範例

本範例會判斷追蹤 SlideShowNextSlide 事件投影片的投影片位置。 如果第三張投影片的下一張投影片,此範例會指標的類型變更為畫筆及為紅色的畫筆顏色。

Private Sub App_SlideShowNextSlide(ByVal Wn As SlideShowWindow)



   Dim Showpos As Integer



   Showpos = Wn.View.CurrentShowPosition + 1

If Showpos = 3 Then  

         With ActivePresentation.SlideShowSettings.Run.View

            .PointerColor.RGB = RGB(255, 0, 0)

            .PointerType = ppSlideShowPointerPen

         End With

      Else

         With ActivePresentation.SlideShowSettings.Run.View

            .PointerColor.RGB = RGB(0, 0, 0)

            .PointerType = ppSlideShowPointerArrow

         End With

      End If

End Sub

本範例會將全域計數器變數設定為零。 然後,它會計算此事件之後投影片上的圖案數目、判斷哪些圖案具有動畫,並以動畫順序和每個圖案的數目填滿全域陣列。

注意事項

[!注意事項] 在這個範例中建立的陣列也會用於 SlideShowNextBuild 事件範例。

Private Sub App_SlideShowNextSlide(ByVal Wn As SlideShowWindow)



   Dim i as Integer, j as Integer, numShapes As Integer

   Dim objSld As Slide



   Set objSld = ActivePresentation.Slides _
        (ActivePresentation.SlideShowWindow.View _
        .CurrentShowPosition + 1)

      With objSld.Shapes

         numShapes = .Count

         If numShapes > 0 Then

            j = 1

            ReDim shpAnimArray(1 To 2, 1 To numShapes)

            For i = 1 To numShapes

               If .Item(i).AnimationSettings.Animate Then

                  shpAnimArray(1, j) = _
                     .Item(i).AnimationSettings.AnimationOrder

                     shpAnimArray(2, j) = i

                     j = j + 1

               End If

            Next

         End If

      End With

End Sub

另請參閱

Application 物件

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應