Pretend I have a sentence like this: "THIS IS MY CASE:"
":" is regular and I want to change its style like The character before it(E). But I don't know which object to use in this case. I want to find The index of ":" then I check Font Style of character before it (index - 1) if they are different I will change Font Style of charater ":" (index) to index - 1.
I try TextFrame.TextRange.Font
but there was something wrong.
Please help me, thank in advance.
Try this code:
Sub test()
Dim sh As Shape, EF As Font, textLen As Integer
For Each sh In ActivePresentation.Slides(1).Shapes
If sh.HasTextFrame Then
textLen = sh.TextFrame.TextRange.Length
If textLen > 1 Then
Set EF = sh.TextFrame.TextRange.Characters(textLen - 1, 1).Font
With sh.TextFrame.TextRange.Characters(textLen, 1).Font
.Name = EF.Name
.Color = EF.Color
.Size = EF.Size
.Italic = EF.Italic
.Bold = EF.Bold
.Underline = EF.Underline
' and other required properties
End With
End If
End If
Next
End Sub