logo
search
VBA & Macro Problems

How to Move a PowerPoint Shape with VBA Without Adding Animations

Elise WilliamsElise Williams Oct 21, 2026 868 views

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.

How to Move a PowerPoint Shape Using VBA Without Adding Animations
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.
Before you start

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.

Solution 1Recommended

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.

1
Name your target shape

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".

2
Open the VBA Editor

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.

3
Enter the movement macros

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.

4
Assign macros to clickable buttons

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.

Directly Adjust Shape Coordinates Using VBA
Boundary Checks: To prevent the shape from moving off the screen, you can add an 'If' condition in your VBA code to verify that the new Left or Top property stays within the bounds of the active slide.
Create Interactive Presentations

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. 1. Open your macro-enabled file: Launch WPS Presentation and open your .pptm file containing the shapes you want to animate.
  2. 2. Access the VBA Editor: Navigate to the Developer tab in the top ribbon and click on 'VBA Editor' to manage your scripts.
  3. 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.
Fully compatible with Microsoft PowerPoint (.pptm) macro filesComprehensive VBA editor for writing and executing custom scriptsLightweight and fast, ensuring smooth execution of interactive slide elements
microsoft office alternative - wps office

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.