![]() |
#1
|
|||
|
|||
![]() Hello, I would like to import a list of names (about 50) from an Excel document into PowerPoint in such a way that each name is on a seperate slide. Ideally I would also like to import a picture with each name as well. Does anyone know how to do this?/Whether this can be done? Thanks, George |
#2
|
||||
|
||||
![]()
Hi george,
Try something based on the following Excel macro: Code:
Sub Excel2PwrPt() ' Requires a reference to Microsoft PowerPoint Object Library Application.ScreenUpdating = False Dim StrPath As String, LRow As Long, i As Long, x As Long StrPath = "C:\Users\George\Documents\" Dim PwrPt As PowerPoint.Application Dim pptPres As PowerPoint.Presentation Dim pptSld As PowerPoint.Slide Dim pptLayout As PowerPoint.CustomLayout ' Create an instance of PowerPoint Set PwrPt = New PowerPoint.Application PwrPt.Visible = True ' Open the presentation Set pptPres = PwrPt.Presentations.Open(Filename:=StrPath & "Presentation1.ppt") x = pptPres.Slides.Count ' Reference active slide Set pptSld = pptPres.Slides(x) With Worksheets("Sheet1") LRow = .Range("A65536").End(xlUp).Row For i = 1 To LRow pptPres.Slides.Add Index:=x + i, Layout:=ppLayoutTitleOnly ' Insert the Excel Cell's value from Column A into the slide title pptPres.Slides(x + i).Shapes(1).TextFrame.TextRange.Text = .Cells(i, 1).Value ' Insert the picture referenced in Column B pptPres.Slides(x + i).Shapes.AddPicture Filename:=StrPath & .Cells(i, 2).Value, _ LinkToFile:=False, Top:=100, Left:=150, Width:=400, SaveWithDocument:=True Next i End With ' Clean up Set pptSld = Nothing: Set pptPres = Nothing: Set PwrPt = Nothing Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
![]()
Thank you Paul for sharing the code.
Could you please elaborate more how can the code be used? In the attached screenshot, for example, I need to included two fields from the excel file into the powerpoint. How such thing can be accomplished using the code? Best Jamal Last edited by macropod; 12-04-2012 at 02:11 PM. Reason: Deleted unnecessary quote of entire previous post. |
#4
|
||||
|
||||
![]()
Hi Jamal,
As written, the code simply inserts text content from column A in the Excel workbook into the first textbox on the new slides it creates (it also inserts a picture onto the page - as per the OP's requirements). You don't need your <Name> or <Course> tags for that. Obviously, if your needs are different, the code would need to be modified to suit - it's not a one-size-fits-all solution. PS: Please don't automatically quote the entire previous post in your replies. If there is a particular element in the previous post that you need to reference, quote just that part.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
![]()
Thank you very much Paul. It is clear now.
Best Jamal |
![]() |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Import field from Excel to Powerpoint | xgravity23 | Office | 8 | 11-22-2012 02:08 PM |
![]() |
andreipopa2k | Word | 1 | 12-09-2011 01:51 PM |
Import formatted text from Word into PowerPoint | parboy | PowerPoint | 0 | 07-06-2011 08:52 AM |
![]() |
Pemberton | PowerPoint | 4 | 08-17-2010 02:10 AM |
![]() |
professor snape | Excel | 1 | 06-06-2009 09:39 AM |