Professional Documents
Culture Documents
Answer
Answer
Sure, here is a simple VBA code snippet that creates a PowerPoint presentation from
Excel data. This code assumes that you have data in column A that goes into one
text box, and the rest of the data goes into another text box.
Sub CreatePPTfromExcel()
' Add data from the rest of the columns to the second text box
Dim j As Long
For j = 2 To ThisWorkbook.Sheets("Sheet1").Cells(i,
Columns.Count).End(xlToLeft).Column
pptSlide.Shapes(2).TextFrame.TextRange.Text =
pptSlide.Shapes(2).TextFrame.TextRange.Text & vbNewLine &
ThisWorkbook.Sheets("Sheet1").Cells(i, j).Value
Next j
Next i
End Sub
Please replace "Sheet1" with your actual sheet name. This code assumes that your
PowerPoint layout has two text boxes. If your layout is different, you may need to
adjust the indices of pptSlide.Shapes accordingly. Also, please remember to save
your work before running this code as VBA can't be undone.