Hi,

I have been trying to make a search/replacement macro for PowerPoint. I have been using the replacement function defined by Microsoft for the purpose (given below).

However, I noticed that if the PowerPoint Presentation includes a Table, then replacements are not performed on these. I have been trying to access the cell contents for the purpose but havent really been successfull. For the timebeing I am ungrouping the table and converting them to shapes and then performing the replacements (see code below).

I have included some of the codes i have been using in my program below.

Please can someone help me in writing a code which can access the text in a cell in a table. I have been able to wite something as shown below, but without success.

VB Code:
  1. ************************
  2. With ActivePresentation.Slides(2).Shapes(4).Table
  3.     .Cell(2, 1).Shape.TextFrame.TextRange.Text = "Replace this"
  4. End With
  5. ************************
Thanks,
Lonely

VB Code:
  1. *******Replace (Code Start)***********
  2. Sub ReplaceText()
  3.    
  4.     Dim oSld As Slide
  5.     Dim oShp As Shape
  6.     Dim oTxtRng As TextRange
  7.     Dim oTmpRng As TextRange
  8.      
  9.     Set oSld = Application.ActivePresentation.Slides
  10.    
  11.     For Each oShp In oSld.Shapes
  12.         Set oTxtRng = oShp.TextFrame.TextRange
  13.         Set oTmpRng = oTxtRng.Replace(FindWhat:="like", _
  14.             Replacewhat:="NOT LIKE", WholeWords:=True)
  15.         Do While Not oTmpRng Is Nothing
  16.             Set oTxtRng = oTxtRng.Characters(oTmpRng.Start + oTmpRng.Length, _
  17.                 oTxtRng.Length)
  18.             Set oTmpRng = oTxtRng.Replace(FindWhat:="like", _
  19.                 Replacewhat:="NOT LIKE", WholeWords:=True)
  20.         Loop
  21.     Next oShp
  22.  
  23. End Sub
  24. *******Replace (Code End)***********