PowerPoint 宏:根据字体颜色更改字体大小

PowerPoint Macro: Change font size based on colour of font

我想写一个 powerpoint 宏,如果我的文本颜色是蓝色,它会改变文本大小的形状。不确定是否可能?感谢您对此的评论

Sub thing()
Dim oSh As Shape
Dim oSl As Slide
Dim RGBColor As Long

' Change this as needed
RGBColor = RGB(255, 0, 0)

For Each oSl In ActivePresentation.Slides
For Each oSh In oSl.Shapes
    If oSh.HasTextFrame Then
        If oSh.TextFrame.HasText Then
            With oSh.TextFrame.TextRange
                If .Font.Color.RGB = RGB(255, 0, 0) Then
                  .Font.Size = 12
                End If
            End With
        End If
    End If
Next
Next
End Sub

或仅更改所选形状:

Sub ChangeFontByColor()
Dim oSh As Shape
Dim RGBColor As Long

' Change this as needed
RGBColor = RGB(255, 0, 0)
  Set oSh = ActiveWindow.Selection.Shaperange(1)    
    If oSh.HasTextFrame Then
        If oSh.TextFrame.HasText Then
            With oSh.TextFrame.TextRange
                If .Font.Color.RGB = RGB(255, 0, 0) Then
                  .Font.Size = 12
                End If
            End With
        End If
    End If
End Sub