Hi everybody,
I hope there is someone who can help me with the following:
My goal is to have an Excel macro where i can put words in Column A that have to be changed in my Powerpoint presentation into the words that are in Column B.
Here is a PowerPoint macro that allready finds and replaces words in PowerPoint, but it's not connected to Excel:
Sub Multi_FindReplace()
Dim sld As Slide
Dim shp As Shape
Dim ShpTxt As TextRange
Dim TmpTxt As TextRange
Dim FindList As Variant
Dim ReplaceList As Variant
Dim x As Long
FindList = Array("Canada", "United States", "Mexico")
ReplaceList = Array("CAN", "USA", "MEX")
'Loop through each slide in Presentation
For Each sld In ActivePresentation.Slides
For Each shp In sld.Shapes
'Store shape text into a variable
Set ShpTxt = shp.TextFrame.TextRange
'Ensure There is Text To Search Through
If ShpTxt <> "" Then
For x = LBound(FindList) To UBound(FindList)
'Store text into a variable
Set ShpTxt = shp.TextFrame.TextRange
'Find First Instance of "Find" word (if exists)
Set TmpTxt = ShpTxt.Replace( _
FindWhat:=FindList(x), _
Replacewhat:=ReplaceList(x), _
WholeWords:=True)
'Find Any Additional instances of "Find" word (if exists)
Do While Not TmpTxt Is Nothing
Set ShpTxt = ShpTxt.Characters(TmpTxt.Start + TmpTxt.Length, ShpTxt.Length)
Set TmpTxt = ShpTxt.Replace( _
FindWhat:=FindList(x), _
Replacewhat:=ReplaceList(x), _
WholeWords:=True)
Loop
Next x
End If
Next shp
Next sld
End Sub
Bookmarks