I found a lot of resources for a search and replace function to find a word that appears on every slide inside of shapes. I got the code to work when it was in powerpoint, but it wont work in the excel module. Again it replaces a certain word on powerpoint slides with the new word from a range in excel. the line in red is where it continues to stop.
Code:
Sub automateppt()
Dim oPPTApp As PowerPoint.Application
Dim oPPTFile As PowerPoint.Presentation
Dim oPPTShape As PowerPoint.Shape
Dim oPPTSlide As PowerPoint.Slide
Set oPPTApp = CreateObject("PowerPoint.Application")
oPPTApp.Visible = msoTrue
With Sheets("Sheet1").Shapes("Object 1").OLEFormat.Verb(Verb:=xlVerbOpen)
End With
Dim sFindMe As String
Dim sSwapme As String
sFindMe = "Old Word"
'change this to suit
sSwapme = "New Word"
Call changeme(sFindMe, sSwapme)
End Sub
Sub changeme(sFindMe As String, sSwapme As String)
Dim oPPTSlide As Slide
Dim oshp As Shape
Dim otemp As TextRange
Dim otext As TextRange
Dim Inewstart As Integer
[COLOR="Red"]For Each oPPTSlide In oPPTApp.ActivePresentation.Slides[/COLOR]
For Each oshp In osld.Shapes
If oshp.HasTextFrame Then
If oshp.TextFrame.HasText Then
Set otext = oshp.TextFrame.TextRange
Set otemp = otext.Replace(sFindMe, sSwapme, , msoFalse, msoFalse)
Do While Not otemp Is Nothing
Inewstart = otemp.Start + otemp.Length
Set otemp = otext.Replace(sFindMe, sSwapme, Inewstart, msoFalse, msoFalse)
Loop
End If
End If
Next oshp
Next oPPTSlide
End Sub