Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Nov 2001
    Posts
    224
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Excel and Powerpoint (2003)

    Hi,

    Can anybody tell me how to place text in an Powerpoint slide from an Excel Macro. Basically I have an EXCEL spreadsheet and I want to write a macro which will read the data from a row and place the data in specific positions on a Powerpoint slide, I have 100 rows and I want to create one slide per row.

    I know how to start the powerpoint application in an Excel macro but not how to place data on the slide in a specific text box or table.

    Any pointers please.

    Regards

    Mike

  2. #2
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Excel and Powerpoint (2003)

    The macro below should get you started. This created a new presentation. If you want to update the existing information in a presentation, I have a demo for that also. I thought it was posted here but I cannot find it. I will post it again if you want, but it is at home. Also this demo uses PowerPoint's standard placeholders. If you really want the info "in a specific text box or table," as you stated, then you will need more guidance. Please give more details. HTH --Sam
    <pre>Sub ppWrite()
    ' Must use the Tools > References menu to add a reference to Microsoft Powerpoint
    Dim ppApp As New PowerPoint.Application
    Dim ppPres As PowerPoint.Presentation
    Dim ppSlide As PowerPoint.Slide
    Dim ppRange As PowerPoint.ShapeRange
    ppApp.Visible = True
    Set ppPres = ppApp.Presentations.Add
    Set ppSlide = ppPres.slides.Add(1, ppLayoutText)
    ppSlide.Shapes(1).TextFrame.TextRange.Text = ActiveCell.Text
    ppSlide.Shapes(2).TextFrame.TextRange.Text = _
    ActiveCell.Offset(0, 1).Text & vbCr & ActiveCell.Offset(0, 2).Text
    ppPres.ApplyTemplate _
    "C:Program FilesMicrosoft OfficeTemplatesPresentation DesignsCrayons.pot"
    Set ppRange = Nothing
    Set ppSlide = Nothing
    Set ppPres = Nothing
    Set ppApp = Nothing
    End Sub</pre>

    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  3. #3
    3 Star Lounger
    Join Date
    Nov 2001
    Posts
    224
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Excel and Powerpoint (2003)

    Hi Sam,

    This is great thanks, but I do need a liitle more please.

    I have a preformated .ppt slide which contains a number of text boxes and a table with 10 fields, so I need to open that .ppt slide, populate the text boxes and tables entries (I can change these to text boxes if it makes it easier), save the slide with a new name and then go around again reading the next record from excel.

    Many thanks

    Mike

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Excel and Powerpoint (2003)

    I have attached a zip file with an example. You will have to study it and adapt if for your situation.

    The preformatted slide is in Master.ppt; the slide contains two text boxes and a table with four cells.
    The workbook contains a small data table and a macro. You must subsitute the correct path for Master.ppt before running it.

  5. #5
    3 Star Lounger
    Join Date
    Nov 2001
    Posts
    224
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Excel and Powerpoint (2003)

    Thanks Hans

    I will work on this today.

    Regards

    Mike

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •