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



我想写一个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

最新更新