PowerPoint 2010 action to run macro resets slideshow animation

Anonymous
2013-03-14T22:45:20+00:00

I have a VBA macro that I wrote and used successfully in PPT2000.  It toggles the size of a shape from near full screen to about an inch wide.  I use the macro in a slideshow presentation to optionally popup an image or unreadable text box and put it back after showing.  I do this in the standard way by creating an action on the shape to run the macro when clicked.   

Since moving to PowerPoint 2010, the macro still works, but it has a disturbing side effect - it resets the animation in the slideshow to the start of the current slide.  So, if I have animated and clicked through several lines of text and then clicked on the shape, the macro runs, but the lines of text disappear and shows the enlarged shape on a slide with just the title up top.  When I click on the shape to put it away, the slide is back at the entry point and I need to click through the text I had already shown.  If I make the mistake of animating the shape itself, the macro runs to enlarge it, but then it disappears (because the animation has been reset).  When I click through the presentation, it appears, enlarged, in order.

Does anyone know what's going on here? In Powerpoint 2000, this ran perfectly.  I could have multiple images or other shapes on a slide with this action, I could pop them up at any time in any order without disturbing the ongoing presentation.  I suspect that there is a setting in PPT2010 that I don't know.  I don't think the problem is in the macro, but I have pasted the VBA below.

Sub full_shape_toggle_large(oShp As Shape)

'Modified for PPT2010

Dim loctop, locleft, codenum, ratio

'use specific screen location to signal a reduction

If oShp.Top = 54 Then

'modify scale factors (were 0.25 in PPT 2000)

oShp.ScaleHeight 0.5, False, msoScaleFromBottomRight

oShp.ScaleWidth 0.5, False, msoScaleFromBottomRight

'pull coded original image location from Alt Text

codenum = oShp.AlternativeText

loctop = Int(codenum / 1000000)

locleft = codenum - (1000000 * loctop)

oShp.ZOrder (msoSendToBack)

oShp.Top = loctop

oShp.Left = locleft

Else 'not at top of screen, must be an increase

loctop = oShp.Top

locleft = oShp.Left

'code and store away the image location

codenum = 1000000 * Int(loctop) + locleft

oShp.AlternativeText = codenum

'make sure it's on top

oShp.ZOrder (msoBringToFront)

oShp.LockAspectRatio = msoTrue

'account for different image aspect ratios

ratio = oShp.Width / oShp.Height

If ratio > 1.33 Then

oShp.Width = 647

Else

oShp.Height = 484

End If

'locate the enlarged image up top

oShp.Top = 54

oShp.Left = 27

End If

End Sub

Thanks,

John

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
{count} votes
Answer accepted by question author
  1. Anonymous
    2013-03-15T07:51:44+00:00

    Any code that changes animated shapes will reset the animation. This has happened since the new animation scheme based on a Timeline came in (version 2002)

    It may not have happened in 2000 which used the old animation scheme but it will in all modern versions

    Maybe you could move the animation to the state when you ran the macro? This is probably 2010 on only. Probably won't work correctly if the animations are NOT On Click!

    Sub fixme(oshp As Shape)

    Dim i As Integer

    i = SlideShowWindows(1).View.GetClickIndex

    'your code here e.g.

    oshp.Width = oshp.Width / 2

    SlideShowWindows(1).View.GotoClick i

    End Sub

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Anonymous
    2013-03-15T12:36:46+00:00

    This was precisely what I needed!  Lets me understand what happened and provides a perfect solution.  Thanks for the quick and 'on the money' response! 

    John

    0 comments No comments
  2. Anonymous
    2016-07-20T12:54:27+00:00

    Hello,

    I have the same problem with me presentation. I have 1 slide with 48 animations and when I begin the presentation a VBA code runs and change some shapes of my slide. Every change restart my animations to the begin.

    My animations are not On Click mode. Can I change a setting in the TimeLine presentation to disable the restart.

    Actually, I use the SlideShowNextBuild method to change shape after each animation.

    I need the same code but with animation without OnClick mode.

    Thank you for your help!

    Romaric

    0 comments No comments