|
本帖最后由 gavincar 于 2017-3-30 09:19 编辑
请问以下代码为什么无法修改字体,只能改变字的大小和颜色。包括形状中的和占位符中的文字
版本:OFFICE2013
Sub OED01() '批量修改字体格式、大小和颜色
Dim oShape As Shape
Dim oSlide As Slide
Dim oTxtRange As TextRange
On Error Resume Next
For Each oSlide In ActivePresentation.Slides
For Each oShape In oSlide.Shapes
Set oTxtRange = oShape.TextFrame.TextRange
If Not IsNull(oTxtRange) Then
With oTxtRange.Font
.Name = "隶书" '改成你需要的字体
.Size = 30 '改成你需要的文字大小
.Color.RGB = RGB(Red:=255, Green:=0, Blue:=0) '改成你想要的文字颜色
End With
End If
Next
Next
End Sub
Sub 批量改PPT字体属性工具()
Dim mySlide As Slide
Dim myShape As Shape
Dim myRng As TextRange
With ActivePresentation
For Each mySlide In .Slides
For Each myShape In mySlide.Shapes
If myShape.HasTextFrame Then
Set myRng = myShape.TextFrame.TextRange
myRng.Font.Name = "微软雅黑"
myRng.Font.Color.RGB = RGB(0, 0, 255)
End If
Next
Next
End With
End Sub
|
|