Hallo, bisher habe ich ein Excel Macro das eine PowerPoint Vorlage öffnet, die Daten aus der Exceltabelle in das Layout der PP überträgt und die PowerPoint abspeichert. Das Problem ist nur, dass ich vorher in der PowerPoint Vorlage entsprechend viele Folien mit dem gewünschten Layout dublizieren muss. Ich möchte aber dass meine Vba Code in Excel automatisch, bei jedem Schleifendurchlauf, weitere Folien (mit dem Layout der ersten Folie) in die PowerPoint einfügt, so dass ich anfangs in meiner PowerPoint Vorlage nur EINE Folie mit dem richtigen Layout haben. Ich konnte bisher nur den Befehl Set pptSlide = ActivePresentation.Slides.AddSlide (2, pptLayout). Danke für Eure Hilfe. LG.
Sub XLSM_to_PPTX()
Dim strPlatz As String
Dim strName As String
Dim strPOTX As String
Dim strPfad As String
Dim pptApp As Object
Dim pptPres As Presentation
Dim pptVorlage As String
Dim i As Integer
Dim a As Integer
strPfad = "C:\Users\Felix\Desktop\Test\"
strPOTX = "Präsentation 2.potx"
Set pptApp = New PowerPoint.Application
pptVorlage = strPfad & strPOTX
pptApp.Presentations.Open Filename:=pptVorlage, untitled:=msoTrue
Set pptPres = pptApp.ActivePresentation
For i = 1 To 5
pptPres.Slides(i).Select
pptPres.Slides(i).Shapes("Themenbereich").TextFrame.TextRange.Characters.Text = Cells(i, 2).Value
pptPres.Slides(i).Shapes("Methodenname").TextFrame.TextRange.Characters.Text = Cells(i, 3).Value
Next i
pptPres.SaveAs strPfad & "Kopie" & ".pptx"
pptPres.Close
pptApp.Quit
Set pptPres = Nothing
Set pptApp = Nothing
End Sub
|