Paul_Hossler
04-13-2012, 05:36 PM
Working a PP 2010 project to apply some cleanup and reformatting to a PP table that is pasted in from an Excel pivot table.
Management is more PP oriented that Excel, so we'll do the number crunching with Excel, summarize with a pivot table and then paste it onto a PP slide.
Bunch of things are applied (so I'll probably be back) but I can't figure out how to do a find and replace to the text in the cells in the table.
Doing it a cell at a time by looping the rows and looping the columns is taking too long.
This doesn't seem to work since it looks like a Table (or the shape) doesn't have a TextFrame ???
Option Explicit
Sub TestThings()
Dim oPres As Presentation
Dim oSlide As Slide
Dim oShape As Shape
Dim oTable As Table
Dim i As Long
Set oPres = ActivePresentation
If oPres Is Nothing Then Exit Sub
Set oSlide = CurrentSlide
If oSlide Is Nothing Then Exit Sub
For Each oShape In oSlide.Shapes
If oShape.HasTable Then
Set oTable = oShape.Table
If oShape.HasTextFrame Then
If oShape.TextFrame.HasText Then
Call oShape.TextFrame.TextRange.Replace(" Total", vbNullString, , msoTrue, msoFalse)
Call oShape.TextFrame.TextRange.Replace("Sum of ", vbNullString, , msoTrue, msoFalse)
Call oShape.TextFrame.TextRange.Replace("Grand Total", "Total", , msoTrue, msoFalse)
Call oShape.TextFrame.TextRange.Replace("(blank)", vbNullString, , msoTrue, msoTrue)
End If
Stop
End If
End If
Next
End Sub
Any help please???
Paul
Management is more PP oriented that Excel, so we'll do the number crunching with Excel, summarize with a pivot table and then paste it onto a PP slide.
Bunch of things are applied (so I'll probably be back) but I can't figure out how to do a find and replace to the text in the cells in the table.
Doing it a cell at a time by looping the rows and looping the columns is taking too long.
This doesn't seem to work since it looks like a Table (or the shape) doesn't have a TextFrame ???
Option Explicit
Sub TestThings()
Dim oPres As Presentation
Dim oSlide As Slide
Dim oShape As Shape
Dim oTable As Table
Dim i As Long
Set oPres = ActivePresentation
If oPres Is Nothing Then Exit Sub
Set oSlide = CurrentSlide
If oSlide Is Nothing Then Exit Sub
For Each oShape In oSlide.Shapes
If oShape.HasTable Then
Set oTable = oShape.Table
If oShape.HasTextFrame Then
If oShape.TextFrame.HasText Then
Call oShape.TextFrame.TextRange.Replace(" Total", vbNullString, , msoTrue, msoFalse)
Call oShape.TextFrame.TextRange.Replace("Sum of ", vbNullString, , msoTrue, msoFalse)
Call oShape.TextFrame.TextRange.Replace("Grand Total", "Total", , msoTrue, msoFalse)
Call oShape.TextFrame.TextRange.Replace("(blank)", vbNullString, , msoTrue, msoTrue)
End If
Stop
End If
End If
Next
End Sub
Any help please???
Paul