1

I need to produce a vast amount of slides, all in the same layout and design, but with different content in a few textboxes. So far i haven't managed to find a non-commerical solution for populating a PowerPoint-Elements with csv/excel-data. Commerical addins (i.e. https://www.presentationpoint.com/software/datapoint/) seem overpriced for a feature that I may require 1 - 2 times a year.

Thanks

1
  • There are quite a few other commercial solutions available at lower price-points. Google "data merge powerpoint" for a host of alternatives. As a disclaimer, I'll mention that I wrote one of them that google turns up, but I'm not going to advertise it here. Mar 3, 2019 at 18:20

1 Answer 1

1

I found a little macro that will do the work for you. I tested it and it works but you have to do some settings around macros in ppt. My translation is not perfect to that but i'll try.

  1. Enable visual basic:

enable the developer-tools in ppt by going to file-options-menubar, make a check to the "developer tools". leave by clicking ok.

  1. get the needed exelobjects for ppt:

go to the new tab "developer-tools" and select "visual basic" then select "extras" on the top and after that "lookup". Find and make a check on "microsoft excel 14.0 object library" or similar. end it by clicking ok

  1. build a module for the macrocode:

do a right-click on the first line of the "project-explorer", f.e. "vba-project(myproject)", choose insert, module

paste the macrocode into the new code-window seen in the middle

Sub CreateSlides()
    '*** Original Sourcecode taken from http://superuser.com/questions/323408/excel-data-into-powerpoint-slides ***
    'Open the Excel workbook. Change the filename here.
    Dim OWB As New Excel.Workbook

    Set OWB = Excel.Application.Workbooks.Open("C:\Tmp\List1.xlsx")
    'Grab the first Worksheet in the Workbook
    Dim WS As Excel.Worksheet
    Dim sCurrentText As String
    Dim sIdentifier As String
    Dim oSl As Slide
    Dim oSh As Shape
    Set WS = OWB.Worksheets(1)
    Dim i As Long
    'Loop through each used row in Column A

    For i = 3 To WS.Range("A65536").End(xlUp).Row
        Debug.Print "Bin hier"
        'Copy the first slide and paste at the end of the presentation
        ActivePresentation.Slides(1).Copy
        ActivePresentation.Slides.Paste
        Set oSl = ActivePresentation.Slides(ActivePresentation.Slides.Count)

        For c = 1 To 3

            sCurrentText = WS.Cells(i, c).Value
            sIdentifier = WS.Cells(2, c).Value

            ' find each shape with sIdentifier of the current column (e.g. "field1~", "field2~", and so on) in text, replace it with value from worksheet
            For Each oSh In oSl.Shapes
                ' Make sure the shape can hold text and if is, that it IS holding text
                If oSh.HasTextFrame Then
                    If oSh.TextFrame.HasText Then
                        ' it's got text, do the replace
                        With oSh.TextFrame.TextRange
                          .Replace sIdentifier, sCurrentText
                        End With
                    End If
                End If
            Next
        Next
    Next

    ActiveWorkbook.Close

End Sub

go back to the default ppt-view by clicking the symbol to the top-left or by hitting alt+f11

  1. build exelsheet:

build an excel-sheet with 1-3 columns (for 1-3 textfields) stored at the same name and folder like in the macro. f.e. "C:\Tmp\List1.xlsx"

the first row is not used

the second row names the default-text of the depending textfield like "field1"

the next rows should include the text of every following slide

struct like:

not used               not used
field1                 field2
mytextforbox1slide1    mytextforbox2slide1
mytextforbox1slide2    mytextforbox2slide2
....

5.build a ppt:

insert a texfield to the first slide and just write "field1" to it

insert a second textfield and just write "field2" to it

maybe you have to rearrange the following top-slides after the macro has finished because only the top one will be used to make copies and fills

  1. run the macro at the developer-tab, macros, run macro

if you understand how the macro works and with a little vba experience you can change the code for your special wants

hope i could help a little bit

busybyte

0

Not the answer you're looking for? Browse other questions tagged .