Search code examples
vbafontssymbolspowerpoint

Replace font name of a particular character in text in Power Point


I want to find and replace all instances of the grave accent ` with the font named Rupee Forandian

Recently the rupee symbol was launched and there is no keyboard symbol for that...

When I try the excel replace function CRTL+H with the format function, it changes the font of the entire text string, while I want it to change only the grave accent `

I found a solution for Excel, but I need a similar one for Powerpoint 2007.

The VBA used in Excel is:

Sub InsertRupeeForandianSymbol()
  Dim X As Long, Cell As Range
  For Each Cell In Selection
    For X = 1 To Len(Cell.Value)
      If Mid(Cell.Value, X, 1) = "`" Then Cell.Characters(X, 1).Font.Name = "Rupee Foradian"
    Next
  Next
End Sub

Solution

  • Easiest way to do this I can think of would be

     Sub InsertRupeeForandianSymbol()
        Dim oSld As Slide
        Dim oShp As Shape
        Dim x As Long
        Dim y As Long
    
        For Each oSld In ActivePresentation.Slides
         For Each oShp In oSld.Shapes
             For y = 1 To Len(oShp.TextFrame.TextRange)
              If Mid(oShp.TextFrame.TextRange, y, 1) = "`" Then
                oShp.TextFrame.TextRange.Characters(y).Font.Name = "Rupee Foradian"
              End If
             Next y
         Next oShp
        Next oSld
    End Sub