Hallo ich habe ein kleines Problem mit meinem Code.
Der Code soll bestimmte Wörter die sich in einer TextBox in einem hinterlegtem PowerPoint Template befinden austauschen. Es soll also von TextBox zu TextBox gegangen werden und der Begriff @COL4@ durch einen Wert aus der Excel Datei ausgetauscht werden.
Das Problem liegt darin, dass alle @Col4@ in jeder TextBox durch den selben Excel Wert ausgetauscht werden. Allerding soll es fortlaufend ein anderer sein. (c12; c13; c14 usw.)
Vl könnt ihr mir weiterhelfen
Vielen Dank
Dim PPSlide As PowerPoint.Slide
Dim Ws As Excel.Worksheet
Dim sCurrentText As String
Dim osl As Slide
Dim osh As Object
Set Ws = Excel.Application.ActiveWorkbook.Worksheets(1)
Dim i As Long
Set PPApp = CreateObject("Powerpoint.Application")
Set PPPres = PPApp.Presentations.Open(Filename:="Pfad", ReadOnly:=True)
PPApp.ActiveWindow.ViewType = ppViewSlide
Set PPSlide = PPPres.Slides _
(PPApp.ActiveWindow.Selection.SlideRange.SlideIndex)
Set osl = PPPres.Slides(1)
Set osh = PPSlide.Shapes
'_____________________________________________________________
For i = 1 To Ws.Range("a24").End(xlUp).Row
sCurrentText = Ws.Cells(i, 1).Value
For Each osh In osl.Shapes
If osh.HasTextFrame Then
If osh.TextFrame.HasText Then
With osh.TextFrame.TextRange
.Replace "@COL4@", sCurrentText
End With
End If
End If
Next
Next
End Sub
|