Share via

Importing text from Excel into multiple text boxes and multiple slides.

Anonymous
2011-01-29T14:53:48+00:00

Okay, here goes...

I have made a template in Powerpoint 2003, (yes, I know - my company won't pay for anything remotely new!)

It has 9 different text boxes, with differing font sizes etc. These relate to 9 different pieces of text in 9 cells on an Excel sheet. For example A1, B1, C1 and so on...

I want to be able to automatically import all 9 lots of text into these text boxes, rather than manually copying-and-pasting all the time.

This, I hope will be simple enough.

However, it gets difficult...

I then need to get the next 9 pieces of text, A2,B2,C2 etc. into the same template on the next slide.

I have 40 rows, so I somehow need to get the text from A1 to I1 into the corresponding text boxes on slide #1, then A2 to I2 on slide 2, all the way up to slide #40 having the text from cells A40 through to I40.

Maybe someone very clever can help?!

Microsoft 365 and Office | PowerPoint | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

3 answers

Sort by: Most helpful
  1. Anonymous
    2011-01-29T16:53:18+00:00

    Hi,

    Several ways to do it depending upon your proficiency in VBA. This basic snippet works from PowerPoint. Paste it into a code module in PowerPoint to run it.

    Sub GetDataFromExcel()

    Dim I As Integer

    Dim oXL As Object 'Excel.Application

    Dim oWB As Object 'Excel.Workbook

    Dim oSld As Slide

    Set oXL = CreateObject("Excel.Application")

    Set oWB = oXL.Workbooks.Open(FileName:="C:\Documents\Data.xls")

    'Assumes the active presentation has 40 slides.

    For I = 1 To 40

        Set oSld = ActivePresentation.Slides(I)

        'Assumes that the first 9 shapes on the slide are the shapes which map to the cells in excel

        ' Alternately you could use shape names to put them in the right textbox

        ' e.g. oSld.Shapes("Textbox 10").TextFrame.TextRange.Text = oWB.Sheets(1).Range("A" & CStr(I)).Value

        ' Copy cell contents from the 1st sheet in Excel to the textboxes in PowerPoint.

        oSld.Shapes(1).TextFrame.TextRange.Text = oWB.Sheets(1).Range("A" & CStr(I)).Value

        oSld.Shapes(2).TextFrame.TextRange.Text = oWB.Sheets(1).Range("B" & CStr(I)).Value

        oSld.Shapes(3).TextFrame.TextRange.Text = oWB.Sheets(1).Range("C" & CStr(I)).Value

        oSld.Shapes(4).TextFrame.TextRange.Text = oWB.Sheets(1).Range("D" & CStr(I)).Value

        oSld.Shapes(5).TextFrame.TextRange.Text = oWB.Sheets(1).Range("E" & CStr(I)).Value

        oSld.Shapes(6).TextFrame.TextRange.Text = oWB.Sheets(1).Range("F" & CStr(I)).Value

        oSld.Shapes(7).TextFrame.TextRange.Text = oWB.Sheets(1).Range("G" & CStr(I)).Value

        oSld.Shapes(8).TextFrame.TextRange.Text = oWB.Sheets(1).Range("H" & CStr(I)).Value

        oSld.Shapes(9).TextFrame.TextRange.Text = oWB.Sheets(1).Range("I" & CStr(I)).Value

    Next

    oWB.Close

    oXL.Quit

    Set oWB = Nothing

    Set oXL = Nothing

    End Sub


    Regards, Shyam Pillai. http://skp.mvps.org

    2 people found this answer helpful.
    0 comments No comments
  2. Anonymous
    2012-06-28T06:39:05+00:00

    Hello All,

    This is great, I am a beginer VBA but really need a sloution for a ongoing powerpoint update. Looking to do it via code.

    My situation is different than above as follows:

    I have one slide with 10 colums and 14 rows of text boxes. I want to extract data from one excel sheet into these text boxes. The data is contanied in cells A2:A15 and B2:B15 this in continued for all rows until J2:J15

    I had used the code above with but could only pull the data from the first column and row in excel.

    My text boxes are named.

    Can you please help!?!!??  I am just an intern at me work and will look amazing if I bring a tool like this !

    0 comments No comments
  3. Steve Rindsberg 99,156 Reputation points MVP Volunteer Moderator
    2011-01-29T22:58:43+00:00

    If you want a pre-made solution, have a look at an add-in of mine:

    PPTMerge at http://www.pptools.com/merge/

    The free demo will let you test it thoroughly.  The contact links on the site will get you in touch if you need any help setting it up.


    Steve Rindsberg PowerPoint MVP

    PowerPoint FAQ

    PPTools Add-ins for PowerPoint

    0 comments No comments