How to Move a PowerPoint Shape with VBA Without Adding Animations
Question details
The user wants to move a specific shape across a presentation slide interactively by clicking, using VBA to update its position without generating new animation effects.

- Product
- PowerPoint
- Device & OS
- not provided
- Scenario
- Creating an interactive presentation, such as a maze or a mini-game, where a user clicks arrows to move an object (like a ball) around the slide.
- Observed behavior
- Applying VBA motion path animations repeatedly creates unwanted entrance effects or complex overlapping animations. The user needs to manipulate the static position of the shape dynamically.
Ensure your presentation is saved as a Macro-Enabled Presentation (.pptm) and that you have enabled the Developer tab in your ribbon to access the VBA editor.
Directly Adjust Shape Coordinates Using VBA
Instead of adding motion path animations, you can use VBA to instantly change the Left and Top properties of a shape based on its current position.
This approach provides precise control over the shape's movement and prevents the presentation from getting cluttered with accumulated animation effects. It directly modifies the shape's geometric coordinates on the slide.
Open your presentation, go to the Home tab, click Select, and open the Selection Pane. Find the shape you want to move (e.g., a circle) and rename it to "ball".
Navigate to the Developer tab and click Visual Basic, or press Alt + F11 on your keyboard. Click Insert > Module to create a new script area.
Paste the macro code to adjust the shape's position. For example, to move right: Sub MoveRight() Dim slide As Slide Set slide = SlideShowWindows(1).View.Slide slide.Shapes("ball").Left = slide.Shapes("ball").Left + 10 End Sub Create a similar MoveLeft macro by subtracting 10 instead of adding.
Insert arrow shapes on your slide to act as buttons. Right-click an arrow, select Action Settings, choose 'Run Macro', and select your MoveRight or MoveLeft macro from the list.

Build Macro-Driven Slides in WPS Presentation
WPS Office provides robust built-in VBA support, allowing you to create complex, interactive presentations with ease. You can run your macro scripts and adjust shape coordinates seamlessly.
- 1. Open your macro-enabled file: Launch WPS Presentation and open your .pptm file containing the shapes you want to animate.
- 2. Access the VBA Editor: Navigate to the Developer tab in the top ribbon and click on 'VBA Editor' to manage your scripts.
- 3. Write and apply the script: Insert your movement macros adjusting the Left and Top properties, then assign them to action buttons using the Action Settings menu.

Frequently Asked Questions
How do I link a VBA macro to a clickable shape?
Select the shape you want to use as a button, navigate to the Insert tab, and click Action. In the Action Settings dialog box, select 'Run Macro' and choose your specific movement macro from the dropdown list.
How can I prevent the shape from moving outside the slide boundaries?
You must add a conditional check in your VBA code before applying the movement. For example, check 'If slide.Shapes("ball").Left > 0' before moving left, and compare against 'ActivePresentation.PageSetup.SlideWidth' before moving right.
Does this VBA method permanently change the shape's position?
Yes, unlike temporary animation effects, modifying the Left and Top properties via VBA changes the actual shape coordinates on the slide. If you want the shape to return to its original position when the slide restarts, you will need to create a 'Reset' macro that moves it back to its starting coordinates.




