views:

144

answers:

2

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");
+3  A: 

Take a look at Shyam Pillai's page here Media Format and Bookmarks that has VBA code for adding animation to MediaFormat object bookmarks.

Otaku
Still not what I was looking for, as I need to add an fade effect to the textbox then associate it somehow to trigger on the bookmark
alex
It works exactly for what you asked for. Just trade `msoAnimEffectPathCircle` out for `msoAnimEffectFade` in `AddBookmarkTrigger`.
Otaku
+1  A: 

Thanks Shyam's code pointed me in the right direction, just had to read it properly! Here is what worked for me that I got from Shyam.

The second trigger effect actually does the opposite of the first one by exiting the fade, note the Exit at the end, again thanks Shyam.

        activeSlide.TimeLine.InteractiveSequences.Add().AddTriggerEffect(
            textBox2,
            MsoAnimEffect.msoAnimEffectFade,
            MsoAnimTriggerType.msoAnimTriggerOnMediaBookmark,
            selectedShape,
            "Bookmark A",
            MsoAnimateByLevel.msoAnimateLevelNone);   

        activeSlide.TimeLine.InteractiveSequences.Add().AddTriggerEffect(
            textBox2,
            MsoAnimEffect.msoAnimEffectFade,
            MsoAnimTriggerType.msoAnimTriggerOnMediaBookmark,
            selectedShape,
            "Bookmark B",
            MsoAnimateByLevel.msoAnimateLevelNone).Exit = MsoTriState.msoTrue;
alex