How can I automate PowerPoint presentations from Excel?

Automating PowerPoint presentations from Excel involves utilizing Excel’s Visual Basic for Applications (VBA) feature. This powerful tool allows you to streamline the process of creating presentations by generating PowerPoint slides based on data and templates defined in Excel. Here’s a step-by-step guide:

Step 1: Activate the Developer Tab

First, you need to activate the Developer tab in Excel. To do this, right-click anywhere on the Ribbon and select ‘Customize the Ribbon’. In the Excel Options dialog box, under the Main Tabs pane, check the Developer box and click OK.

Step 2: Write a VBA Code

The next step is to write a VBA code. Open the VBA Editor by clicking on the Developer tab and selecting ‘Visual Basic’. In the VBA Editor, under ‘Insert’, click on ‘Module’ to create a new module. Write your code in this module.

Here’s a simple example of a VBA code you can use:

Sub CreatePowerPoint()

    'Add a reference to the Microsoft PowerPoint Library by:
    '1. Going to Tools in VBA editor
    '2. Click on Reference
    '3. Scroll down to Microsoft PowerPoint X.0 Object Library, check the box, and press Okay

    'First we declare the variables we will be using
    Dim newPowerPoint As PowerPoint.Application
    Dim activeSlide As PowerPoint.Slide
    Dim cht As Excel.ChartObject

    'Look for existing instance
    On Error Resume Next
    Set newPowerPoint = GetObject(, "PowerPoint.Application")
    On Error GoTo 0
    
    'Let's create a new PowerPoint
    If newPowerPoint Is Nothing Then
        Set newPowerPoint = New PowerPoint.Application
    End If
    
    'Make a presentation in PowerPoint
    If newPowerPoint.Presentations.Count = 0 Then
        newPowerPoint.Presentations.Add
    End If
    
    'Show the PowerPoint
    newPowerPoint.Visible = True

    'Loop through each chart in the Excel worksheet and paste them into the PowerPoint
    For Each cht In ActiveSheet.ChartObjects
    
        'Add a new slide where we will paste the chart
        newPowerPoint.ActivePresentation.Slides.Add newPowerPoint.ActivePresentation.Slides.Count + 1, ppLayoutText
        newPowerPoint.ActiveWindow.View.GotoSlide newPowerPoint.ActivePresentation.Slides.Count
        Set activeSlide = newPowerPoint.ActivePresentation.Slides(newPowerPoint.ActivePresentation.Slides.Count)
    
        'Copy the chart and paste it into the PowerPoint
        cht.Select
        ActiveChart.ChartArea.Copy
        activeSlide.Shapes.PasteSpecial DataType:=ppPasteMetafilePicture
    
        'Adjust the positioning of the Chart on Powerpoint Slide
        activeSlide.Shapes(1).Top = 15
        activeSlide.Shapes(1).Left = 80
        activeSlide.Shapes(1).Height = 400
    Next

End Sub

This code creates a new PowerPoint presentation and adds a slide for each chart in your active Excel worksheet. Each chart is pasted as a picture on a new slide.

Step 3: Run the VBA Code

After writing the VBA code, close the VBA Editor. You can run the VBA code by clicking on the ‘Macros’ button in the Developer tab, selecting the name of your macro from the list, and clicking ‘Run’.

Remember that VBA is a powerful tool and can be complex, so if you need more advanced automation, it may require a deeper understanding of VBA and coding principles. If you’re not comfortable with writing your own VBA code, consider reaching out to SlideGenius. Our team of PowerPoint experts can help automate your PowerPoint presentations to save you time and ensure a professional outcome.

View Our Presentation Portfolio

Three overlapping slides are displayed. The first slide reads "American Express Investor Day 20XX." The second slide has "Today's Discussion." The third features a man reading and mentions, "Service is the Core of Our Global Program" and "Custom PowerPoint Presentation Design Support.

Ready to kick off your project?

Fill out the form below to speak
with a SlideGenius representative.