PPT.SlideShowClicks in MS PowerPoint 2010 to Control Animation Click Behavior in VB.NET

In this article I am going to explain about how to Control Animation Click Behavior in a Microsoft PowerPoint 2010 .
  • 3020

Introduction

In this article I am going to explain about how to Control Animation Click Behavior in a Microsoft PowerPoint 2010. For this we use  GetClickCount method, the GetClickIndex method, and the GotoClick method in Microsoft PowerPoint 2010. These methods used to control the click behavior for animations in Microsoft PowerPoint 2010 presentations.

In this application first we write this code in VBA then run it using F5. After this start slide show and watch it carefully then go to at VBA window reset it and run it three time. Now again start slide show, you will see some changes in behavior of slide show after completion of one round.

Microsoft Office 2010 offer some powerful tools, using this tools you can create application. Using Microsoft Visual Basic for Applications (VBA) you can create your own application according to your need. These application can performer some specific task.

For creating application we can use

  • VBA host of Excel 2010
  • VBA host of PowerPoint 2010
  • VBA host of Word 2010

NOTE : OneNote 2010 is not a VBA host.

Code that we use in this application are given below

Sub SlideShowClicks()

    If SlideShowWindows.Count = 0 Then
        
Exit Sub
    End 
If 

    Dim vip As SlideShowView
    vip = SlideShowWindows(1).View 

    Debug.Print("First animation is automatic: " & vip.FirstAnimationIsAutomatic)
    Debug.Print("Click animations: " & vip.GetClickCount)
    Debug.Print("Current click position (before GotoClick):  " & vip.GetClickIndex)
    vip.GotoClick(2)
    Debug.Print("Current click position (after GotoClick):  " & vip.GetClickIndex) 

End Sub 

Sub CreateShapesAndAnimations()

    Dim a As Slide
    a = ActivePresentation.Slides(1)
    Dim shp As Shape 

    ' Create a shape and add it to the timeline.
    shp = a.Shapes.AddShape(msoShapeCloud, 10, 10, 200, 200)
    shp.Fill.ForeColor.RGB = vbRed
    a.TimeLine.MainSequence.AddEffect(shp, effectId:=msoAnimEffectBoomerang, 
    trigger:=msoAnimTriggerWithPrevious) 

    ' Repeat for a second shape.
    shp = a.Shapes.AddShape(msoShape8pointStar, 150, 240, 200, 200)
    shp.Fill.PresetGradient(msoGradientHorizontal, 1, msoGradientDaybreak)
    a.TimeLine.MainSequence.AddEffect(shp, effectId:=msoAnimEffectAscend) 

    ' Add a third shape.
    shp = a.Shapes.AddShape(msoShapeDecagon, 500, 10, 200, 200)
    shp.Fill.Solid()
    shp.Fill.ForeColor.ObjectThemeColor = msoThemeColorAccent4
    a.TimeLine.MainSequence.AddEffect(shp, effectId:=msoAnimEffectDescend) 

    ' Add a fourth shape.
    shp = a.Shapes.AddShape(msoShapeCan, 500, 240, 200, 200)
    shp.Fill.Solid()
    shp.Fill.ForeColor.ObjectThemeColor = msoThemeColorAccent2
    a.TimeLine.MainSequence.AddEffect(shp, effectId:=msoAnimEffectCenterRevolve)


End
 Sub

Step for creating Application

Step 1 : Start Microsoft PowerPoint 2010 :

1.jpg
 

Step 2 : Using Alt + F11 Key Start Visual Basic for Applications (VBA) Window :

2.jpg
 

Step 3 : Select on VBAProject(Presentation 1) :

3.jpg
 

Step 4 : Right Click On VBAProject(Presentation 1) ==> Goto Insert==> Goto Module & click on Module:

4.jpg
 

Step 5 : Write Code in Visual Basic for Applications (VBA) Window :

Clipboard021.jpg
 

Step 6 : Run Application using F5 :

Step 7 : Macros window will open, Select Macros name and click on Run Button :

Clipboard033.jpg
 

Step 8 : Output of Application :

Output of first round slide show

Slide show after completion of first round slide show.

Clipboard15.jpg

Clipboard17.jpg
 


 

 Clipboard07.jpg

 

  

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.