PowerPoint Macro to distribute shapes vertically

Posted on 2012-09-14
Last Modified: 2012-09-17
I know essentially nothing about macros but really need one here.

I am working on several hundred PowerPoint presentations, each containing several hundred slides. On each slide is one text box and one table. In short: the table overlaps the text box and I want to distribute them vertically on the slide.

The problem is that the PowerPoints are created by exporting data from an online application directly into PowerPoint. The export aligns everything horizontally (centered) but the text boxes and tables overlap. There is no way to change the features or settings of the export.

As my only other option is to manually drag each table on each slide, or select all and distribute vertically, I would MUCH rather have a macro to do this.

I have explored quite a lot of samples of VBA code and can even get one that works, provided I have manually selected all of the shapes on the slide, which sort of defeats the purpose.

I know I need something like the following sequence (this is just what I want to happen, not an attempt at code):

For each slide in the presentation
Select all shapes (or select shape range?)
Distribute Vertically

That's it! That's all I need! But I cannot make it happen. To help matters, I'm using Office 2011 on a Mac and there is no "record macro" feature. It simply isn't included.

Help? Anyone? Please?
Question by:e_m_h
    LVL 23

    Accepted Solution

    Don't use a Mac but this would work on a PC

    Sub DVert()
    Dim osld As Slide
    For Each osld In ActivePresentation.Slides
    With osld.Shapes.Range
    .Distribute msoDistributeVertically, msoTrue
    End With
    Next osld
    End Sub

    Author Closing Comment

    It's perfect. Thank you!

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Setting the Scene PowerPoint is a creative tool in the right hands but it also includes a much underutilised programming dimension. In this beginner level article, we're going to show you some of some key elements of programming PowerPoint using th…
    In this article we will discuss some EI Capitan Mail app issues and provide some manual process to resolve them.
    This video teaches viewers how to add transitions to their Slideshows and how to set up timing for the transitions.
    The viewer will learn how to edit animations within the presentation, incorporate sound, and set everything up with timing.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now