title: How do I replace words in entire powerpoint including tables using VBA?
body: <p>I have to go through numerous powerpoints replacing specific words with new ones. I made a macro that seemed to work, however after closer examination I realized that words within tables were not being replaced. After some searching I saw other people having this issue but no clear answer. I came up with the following but I also get the runtime error "This member can only be accessed for a group" on the line that reads <code>For Each grpItem In shp.GroupItems</code> </p>
  
  <p>Could someone provide insight as to what I'm doing wrong, or perhaps a better way to do this?</p>
  
  <pre><code> Sub DataScrubAllSlidesAndTables()
      Dim sld As Slide
      Dim grpItem As Shape
      Dim shp As Shape
  
  For Each sld In ActivePresentation.Slides
      For Each shp In sld.Shapes
  
          If shp.HasTextFrame Then
              If shp.TextFrame.HasText Then
                  shp.TextFrame.TextRange.Text = Replace(shp.TextFrame.TextRange.Text, "Store", "Seller")
                  shp.TextFrame.TextRange.Text = Replace(shp.TextFrame.TextRange.Text, "Customer", "Buyer")
              End If
          End If
  
          If shp.Type = msoTable Then
                  For Each grpItem In shp.GroupItems
                      If InStr(1, grpItem.Name, "Rectangle") Then
                          grpItem.TextFrame.TextRange.Text = Replace(grpItem.TextFrame.TextRange.Text, "Store", "Seller")
                          grpItem.TextFrame.TextRange.Text = Replace(grpItem.TextFrame.TextRange.Text, "Store", "Seller")
                      End If
                  Next grpItem
          End If
  
      Next shp
  Next
  End Sub
  </code></pre>