I modified the code so that I am able to search grouped shapes and tables and MS Objects... The code is as follows:
Problem: It selects any text which is there in the shapes adn replaces it with the 'ReplaceWith'...
It Finds any text present in the table and replaces it with nothing
It doesnt take me to the current slide where it is making changes...
HELP PLEASE ...
-----------Macro-----------------
Sub Global_1()
Dim oPres As Presentation
Dim oSld As Slide
Dim oShp As Shape
Dim FindWhat As String
Dim ReplaceWith As String
FindWhat = "This"
ReplaceWith = "That"
For Each oPres In Application.Presentations
For Each oSld In ActivePresentation.Slides
For Each oShp In oSld.Shapes
Call FindnRe(oShp, FindWhat, ReplaceWith)
Next oShp
Next oSld
Next oPres
End Sub
-----------For Reference-----------------
Sub FindnRe(oShp As Object, FindString As String, ReplaceString As String)
Dim oTxtRng As TextRange
Dim oTmpRng As TextRange
Dim I As Integer
Dim iRows As Integer
Dim iCols As Integer
Dim oShpTmp As Shape
On Error Resume Next
Select Case oShp.Type
Case 19 'msoTable
For iRows = 1 To oShp.Table.Rows.Count
For iCol = 1 To oShp.Table.Rows(iRows).Cells.Count
Set oTxtRng = oShp.Table.Rows(iRows).Cells(iCol).Shape.TextFrame.TextRange
Set oTmpRng = oTxtRng.Replace(FindWhat:=FindString, _
Replacewhat:=ReplaceString, WholeWords:=True)
Do While Not oTmpRng Is Nothing
oTmpRng.Select
If MsgBox("Replace?", vbYesNo) = vbYes Then oTmpRng.Text = strReplaceWith
Set oTmpRng = oTxtRng.Replace(FindWhat:=FindString, _
Replacewhat:=ReplaceString, _
After:=oTmpRng.Start + oTmpRng.Length, _
WholeWords:=True)
Loop
Next
Next
Case msoGroup 'Groups may contain shapes with text, so look within it
For I = 1 To oShp.GroupItems.Count
Call FindnRe(oShp.GroupItems(I), FindString, ReplaceString)
Next I
Case 21 ' msoDiagram
For I = 1 To oShp.Diagram.Nodes.Count
Call FindnRe(oShp.Diagram.Nodes(I).TextShape, FindString, ReplaceString)
Next I
Case Else
If oShp.HasTextFrame Then
If oShp.TextFrame.HasText Then
Set oTxtRng = oShp.TextFrame.TextRange
oTxtRng.Select
If MsgBox("Replace?", vbYesNo) = vbYes Then oTmpRng.Text = strReplaceWith
Set oTmpRng = oTxtRng.Replace(FindWhat:=FindString, _
Replacewhat:=ReplaceString, WholeWords:=True)
Do While Not oTmpRng Is Nothing
Set oTmpRng = oTxtRng.Replace(FindWhat:=FindString, _
Replacewhat:=ReplaceString, _
After:=oTmpRng.Start + oTmpRng.Length, _
WholeWords:=True)
Loop
End If
End If
End Select
End Sub