PowerPoint Slides From Excel List

PowerPoint Slides from Excel List

If you have a list of names or topics in Excel, here’s how you can quickly create PowerPoint slides from that list. Unlike most of my macros, these run in PowerPoint, to pull the data from Excel. That was easier than writing Excel macros to make things happen in PowerPoint!

Create a Slide for Each Excel Item

In these macros, the main PowerPoint slide is duplicated. Then, the data from Excel is added to the text boxes on the new slide.

There are 4 macros, with variations for

  • 1 or 2 text boxes on the slide
  • all Excel rows, or based on criteria

You can download the free files from my Contextures site. There’s a zipped folder with the PowerPoint presentation, and an Excel file with data for the slides.

Slide Data in Excel List

There’s a small named table in the sample Excel file, with data for the PowerPoint slides.

You can use this for testing, before trying the macros with your own Excel data.

Excel list with data for powerpoint slides
Excel list with data for PowerPoint slides

PowerPoint Main Slide

In PowerPoint, the first slide in the presentation has two text boxes.

The macro duplicates the first slide, and puts the Excel information in those text boxes

In the sample file, don’t move the main slide, if you want the macros to work correctly!

first slide in the presentation has two text boxes
first slide in the presentation has two text boxes

PowerPoint Main Slide

That first slide in the presentation is based on a Master slide.

  • You can edit its Master slide, to change the background or text box settings.
  • You can also replace that chart icon with your company logo, or add other features.
You can edit its Master slide
You can edit its Master slide

More PowerPoint Slides

In the PowerPoint file that you can download from my Contextures site, there are 2 other slides.

  • Those additional slides have notes on using the macros, and formatting the Slide Master.
  • These slides aren’t needed by the macro, and you can delete them.
additional slides have notes on using the macros
additional slides have notes on using the macros

How to Run Macro to Create Slides

To create PowerPoint slides, from a list in Excel, follow these steps:

  1. Open the Excel file where your list is stored
  2. Activate the sheet where the data is stored – the list must be formatted as a named Excel table
  3. Open the PowerPoint presentation that contains the macros and main slide
  4. Be sure the main slide, that you want to duplicate, is the first slide in the presentation
  5. At the top of PowerPoint, on the View tab, click Macros
  6. Select one of the Create Slides macros, and click Run
run macro to create new slides from data in Excel
run macro to create new slides from data in Excel

Check the New Slides

After the macro runs, you can check the new slides that were added to the PowerPoint presentation.

  • In this example, I ran the macro for 2 text boxes, and checked column 3 in the data, for a “Y”
  • Three of the rows have a “Y”, so 3 slides were added to the presentation.

NOTE: This macro code is further down the page, and all four macros are in the sample PowerPoint file.

3 new slides from Excel data
3 new slides from Excel data

Save the PowerPoint Slides

After you run the macro, and create the duplicate slides:

  • Save the PowerPoint file with a new name.
  • Then, in that new file, delete the main slide and the two notes slides, or hide them.

NOTE: If you simply export the new slides, you’ll lose the formatting, because they’re based on the Master Slide in the original PowerPoint file.

Create a Presentation Template

Another option is to save the PowerPoint file in PowerPoint Macro-Enabled Template (potm) format.

By default, that file will be saved in your Custom Office Templates folder.

save the PowerPoint file in PowerPoint Macro-Enabled Template (potm) format
save the PowerPoint file in PowerPoint Macro-Enabled Template (potm) format

Then, to create a new set of slides from Excel data:

  • In PowerPoint, click File, then click New
  • In the Templates section, click Personal
  • Click on the Slides from Excel template, then click Create
create new presentation from custom template
create new presentation from custom template

PowerPoint Slides From Excel Macro Code

Here is the code for the CreateSlidesTest_Text2  macro that fills two text boxes on a slide, and checks the Excel table for criteria.

NOTE: To use the macro with a different Excel table, you can change the variable settings, in this section of the macro code.

     'columns with text for slides
     col01 = 1
     col02 = 2
     'test column and criterion
     colTest = 3
     strTest = "y"

This macro creates slides for items in the Excel list, after checking a criteria cell, and fills 2 text boxes.

  • In Excel, checks the test column (colTest), and creates a slide if it contains the specified text string (strTest)
  • In the PowerPoint slide, text from the specified columns (col01 and col02), is entered in the 1st text box and 2nd text box
Sub CreateSlidesTest_Text2()
'https://www.contextures.com
'create slide for names
' that pass criteria test
'fill two text boxes
Dim myPT As Presentation
Dim myMain As Slide
Dim myDup As Slide

Dim xlApp As Object
Dim wbA As Object
Dim wsA As Object
Dim myList As Object
Dim myRng As Object
Dim i As Long
Dim col01 As Long
Dim col02 As Long
Dim colTest As Long
Dim strTest As String

'columns with text for slides
col01 = 1
col02 = 2
'test column and criterion
colTest = 3
strTest = "y"

On Error Resume Next
Set myPT = ActivePresentation
Set myMain = myPT.Slides(1)

Set xlApp = GetObject(, "Excel.Application")
Set wbA = xlApp.ActiveWorkbook
Set wsA = wbA.ActiveSheet
Set myList = wsA.ListObjects(1)
On Error GoTo errHandler

If Not myList Is Nothing Then
  
  Set myRng = myList.DataBodyRange
  
  For i = 1 To myRng.Rows.Count
    'Copy first slide, paste after last slide
    If UCase(wsA.Cells(i, colTest).Value) _
        = UCase(strTest) Then
      With myPT
        'Duplicate slide 1, move after last slide
        myMain.Duplicate
        Set myDup = .Slides(2)
        myDup.MoveTo myPT.Slides.Count
        
        'change text in 1st textbox
        myDup.Shapes(1).TextFrame.TextRange.Text _
            = myRng.Cells(i, col01).Value
         
         'change text in 2nd textbox
        myDup.Shapes(2).TextFrame.TextRange.Text _
            = myRng.Cells(i, col02).Value
      End With
    End If
  Next
Else
  MsgBox "No Excel table found on active sheet"
  GoTo exitHandler
End If

exitHandler:
  Exit Sub
errHandler:
  MsgBox "Could not complete slides"
  Resume exitHandler:
End Sub

Learn More About PowerPoint Macros

There are PowerPoint code samples on the Microsoft site, that helped me get started with these macros to create slides from Excel data.

For more examples, you can check the StackOverflow forum, or PowerPoint sites.

Get the PowerPoint Slide Files

You can download the free files from my Contextures site. There’s a zipped folder with the PowerPoint presentation, and an Excel file with data for the slides.

The macros that create slides are stored in the PowerPoint file. There are no macros in the Excel workbook

______________________________

PowerPoint Slides from Excel List

powerpointslidesfromexcel01a

PowerPoint Slides from Excel List

_____________________________

4 thoughts on “PowerPoint Slides From Excel List”

  1. Does this work on Macs? I keep getting the “No Excel table found on active sheet” when I try to run it. I’ve been using the sample slides and sample worksheet and I am sure to have the sheet with the table “activated” (clicked on? this just means clicked on, right?) when I try to run the macros. None of them work, they all give the sam error message. I also went into VBA editor Tools/References in both programs to make sure the other was clicked on. No luck. Thoughts? Help?

    1. I don’t think it works on Macbook. I had the same error, tried it on a Windows laptop and worked perfectly.

      It also has some problems with large data sets and stops running the code after a few hundred rows, (I had almost 1000 rows) but a quick fix would be to delete the rows that it has already done and run again. It will add the new slides after the last slide in the powerpoint.

      To the person behind this: thank you so much. You have saved me hours of my life. I was populating each of my slides manually and it took me the whole day to get through 1/16th fo the work. With this code, took me <5 minutes. Thank you so much.

  2. When I click RUN, it only makes about 10 of 219 slides. I am trying to do a list of names.
    The error says “Could not complete Slides”

    Any help would be appreciated

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.