A family of Microsoft presentation graphics products that offer tools for creating presentations and adding graphic effects like multimedia objects and special effects with text.
If you are selecting a Table, or just selecting the text in one cell of the table (or if you just select the text in the TextBox and not the TextBox itself), the Type of the Selection changes and you must deal with it slightly differently. Try something like the code below.
Hope this helps,
Eric
Option Explicit
Sub testit()
Dim i As Long
Dim counter As Long
Dim v1 As TextRange2
Dim myTable As Table, myRow As Row, myCell As Cell
Select Case ActiveWindow.Selection.Type
Case ppSelectionShapes ' This is some kind of shape
Select Case ActiveWindow.Selection.ShapeRange.Type
Case msoTextBox ' The shape is a TextBox
For Each v1 In ActiveWindow.Selection.ShapeRange.TextFrame2.TextRange
If v1.Runs.Count > 0 Then
For counter = 1 To v1.Runs.Count
v1.Runs(counter).Font.Fill.Solid
v1.Runs(counter).Font.Fill.ForeColor.RGB = RGB(255, 123, 25)
Next counter
End If
Next
Case msoTable ' The shape is a Table
Set myTable = ActiveWindow.Selection.ShapeRange.Table
For Each myRow In myTable.Rows
For Each myCell In myRow.Cells
For Each v1 In myCell.Shape.TextFrame2.TextRange
If v1.Runs.Count > 0 Then
For counter = 1 To v1.Runs.Count
v1.Runs(counter).Font.Fill.Solid
v1.Runs(counter).Font.Fill.ForeColor.RGB = RGB(255, 123, 25)
Next counter
End If
Next
Next myCell
Next myRow
Case Else
End Select
Case ppSelectionText ' This is just selected text (in some shape)
Set v1 = ActiveWindow.Selection.TextRange2
If v1.Runs.Count > 0 Then
For counter = 1 To v1.Runs.Count
v1.Runs(counter).Font.Fill.Solid
v1.Runs(counter).Font.Fill.ForeColor.RGB = RGB(255, 123, 25)
Next counter
End If
Case Else
End Select
End Sub