Looking for a way in PowerPoint to search and replace all (R) normal text with (R) superscript text

88 views Asked by At

I am looking for a way in PowerPoint to search and replace the registered trademark symbol (R) in normal text with (R) in superscript text. I have tried the normal search and replace by copying the superscript text. This doesnt work, also tried to replace with ^c for clipboard, but that only seems to work in word. I have a really long document where I need to replace all registered symbols with a superscript version. I eventually found this - but it does not work where the text is in a table.

Sub superscript()
Dim osld As Slide
Dim oshp As Shape
Dim ipos As Integer
For Each osld In ActivePresentation.Slides
For Each oshp In osld.Shapes
If oshp.HasTextFrame Then
ipos = InStr(1, oshp.TextFrame.TextRange, Chr(174))
If ipos > 0 Then
Do
oshp.TextFrame.TextRange.Characters(ipos).Font.superscript = msoTrue
ipos = InStr(ipos + 1, oshp.TextFrame.TextRange, Chr(174))
Loop Until ipos = 0
End If
End If
Next oshp
Next osld
End Sub

Thank you.

1

There are 1 answers

1
Steve Rindsberg On

Luckily, there's a simpler way:

Option Explicit

Sub Superscript()
Dim osld As Slide
Dim oshp As Shape

For Each osld In ActivePresentation.Slides
For Each oshp In osld.Shapes
If oshp.HasTextFrame Then
If oshp.TextFrame.HasText Then

While InStr(oshp.TextFrame.TextRange.Text, "(R)") > 0
    oshp.TextFrame.TextRange.Characters.Replace "(R)", Chr$(174)
Wend

End If
End If

Next oshp
Next osld
End Sub