Share via

powerpoint programmatically add textbox animation triggered by bookmark in mediaobject

Anonymous
2010-08-19T03:25:04+00:00

I am trying to programmatically add an fade effect on a textbox which is triggered by a bookmark in a mediaobject, eg movie. 

So when the movie plays and reaches the bookmark the textbox will appear with the fade effect.

I have gotten as far as being able to add the textbox to the slide and adding the bookmarks to the mediaobject shape eg using the following code

Now where am I supposed to add the fade effect? VSTO or vba code will really help! this is all in office 14

var application = Globals.ThisAddIn.Application;

PowerPoint.Slide activeSlide = application.ActiveWindow.View.Slide;

PowerPoint.Shape selectedShape = application.ActiveWindow.Selection.ShapeRange[1];

selectedShape.MediaFormat.MediaBookmarks.Add(2000, "Bookmark A");

selectedShape.MediaFormat.MediaBookmarks.Add(5000, "Bookmark B");

selectedShape.MediaFormat.MediaBookmarks.Add(9000, "Bookmark C");

PowerPoint.Shape textBox1 = activeSlide.Shapes.AddTextbox(Office.MsoTextOrientation.msoTextOrientationHorizontal, 0, 0, 500, 50);

textBox1.Name = "TextBox1";

textBox1.TextFrame.TextRange.InsertAfter("TextBox1 text");

PowerPoint.Shape textBox2 = activeSlide.Shapes.AddTextbox(Office.MsoTextOrientation.msoTextOrientationHorizontal, 0, 30, 500, 50);

textBox2.Name = "TextBox2";

textBox2.TextFrame.TextRange.InsertAfter("TextBox2 text");

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

1 answer

Sort by: Most helpful
  1. Anonymous
    2010-08-19T15:10:07+00:00

    Hi,

    Here is the vba code to add a bookmark trigger from my page: http://skp.mvps.org/2010/ppt002.htm

    Sub AddBookmarkTrigger()

    Dim oShp As Shape         ' Shape with animation that needs to be triggered via bookmark

    Dim oShpMovie As Shape    ' Media shape

    'Assumes that we have a media shape with 'Bookmark 1' on slide 1 of the presentation

    With ActivePresentation.Slides(1)

            Set oShpMovie = .Shapes(1)

            Set oShp = .Shapes(2)

            ' Assign an trigger to shape

            ' if no bookmark name is specified, it will default to 1st. If no bookmark exists then it fails

            Call .TimeLine.InteractiveSequences.Add.AddTriggerEffect(oShp, msoAnimEffectPathCircle, _  

                                    msoAnimTriggerOnMediaBookmark, oShpMovie, "Bookmark 1")

    End With

    End Sub

    Regards,

    Shyam Pillai

    Was this answer helpful?

    0 comments No comments