I have an Excel document with around 400 lines of data. They are sorted by column. For example, Column A is the name, B is Group, C is Location, D is Department, E is Note, and F is submitter.
I need this data to go into specific text boxes in a PowerPoint file. I found the following code:
Sub CreateSlides()
'Open the Excel workbook. Change the filename here.
Dim OWB As New Excel.Workbook
Set OWB = Excel.Application.Workbooks.Open("C:\list.xlsx")
'Grab the first Worksheet in the Workbook
Dim WS As Excel.Worksheet
Set WS = OWB.Worksheets(1)
'Loop through each used row in Column A
For i = 1 To WS.Range("A65536").End(xlUp).Row
'Copy the first slide and paste at the end of the presentation
ActivePresentation.Slides(1).Copy
ActivePresentation.Slides.Paste (ActivePresentation.Slides.Count + 1)
'Change the text of the first text box on the slide.
ActivePresentation.Slides(ActivePresentation.Slides.Count).Shapes(1).TextFrame.TextRange.Text = WS.Cells(i, 1).Value
Next
End Sub
It created several slides (as it should have) and imported the info from Column A right to where it should have been placed.
My problem is I don't know how to get the rest of the text to populate where it should.
Aucun commentaire:
Enregistrer un commentaire