Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to add a little visual basic to a PowerPoint slide. I usually work in Excel and was surprised to learn PowerPoint doesn't offer a record feature. My slide currently has six charts on it lined up in a simple 2 by 3 grid. I'd like to be able to create some VB code that does the following when I click any particular chart:

  1. When chart is clicked, it is brought to front and then expands to fill the whole page.
  2. When clicked a second time, it will shrink and return to it place in the 2 by 3 grid of charts.

Is this possible in PowerPoint. I went looking for properties information that would enable me to control the location of the chart objects, but was unable to figure out where this information lies.

share|improve this question

Add this to your presentation, save it as PPTM, then select each of the charts in turn; Insert | Action | Run Macro: ResizeMe

You'll want to make sure the charts are proportional to the slide size to begin with (or modify the lines that set the chart to full screen to use different proportions).

You'll also want to make sure that the chart shapes' Aspect Ratio is not set to Locked.

Sub ResizeMe(oSh As Shape)

    With oSh

        ' Is the shape full screen or normal?
        If .Left = 0 Then    ' it's full screen
            .Left = CSng(.Tags("Left"))
            .Top = CSng(.Tags("Top"))
            .Height = CSng(.Tags("Height"))
            .Width = CSng(.Tags("Width"))
        Else    ' it's small; biggify it:
            ' first, record it's small coordinates:
            .Tags.Add "Left", CStr(.Left)
            .Tags.Add "Top", CStr(.Top)
            .Tags.Add "Height", CStr(.Height)
            .Tags.Add "Width", CStr(.Width)
            ' now make it full screen
            .Left = 0
            .Top = 0
            .Height = ActivePresentation.PageSetup.SlideHeight
            .Width = ActivePresentation.PageSetup.SlideWidth
        End If

    End With

End Sub
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.