需要同时批量修改字体、文字大小和颜色,需要用到宏了。可以使用下面这段宏:
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 = "楷体_GB2312" '更改为需要的字体
.Size = 20 '改为所需的文字大小
.Color.RGB = RGB(Red:=255, Green:=0, Blue:=0) '改成想要的文字颜色(黑色),用RGB参数表示
End With
End If
Next
Next
End Sub
Sub OED03()
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
.Color.RGB = RGB(Red:=255, Green:=0, Blue:=0) '改成黑色,用RGB参数表示
End With
End If
Next
Next
End Sub
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
.Color.RGB = RGB(Red:=0, Green:=0, Blue:=255) '改成蓝色,用RGB参数表示
End With
End If
Next
Next
End Sub
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
.Color.RGB = RGB(Red:=0, Green:=0, Blue:=0) '改成白色,用RGB参数表示
End With
End If
Next
Next
End Sub
原来的ppt文字不是黑色的,通过宏将该ppt文件中的100多页ppt文字改为黑色(注意是将某个颜色的字,比如桔红色的字改为黑色,不是所有文字变成黑色)。如果手动修改颜色,工作量太大,偷个懒,写个程序,让ppt中的这种文字颜色统一改变成黑色。
PowerPoint 2007 隐藏的功能 录制宏
使用快捷键 Alt+T -> M -> R 能够调出隐藏的功能 录制宏
再使用一次 Alt+T -> M -> R 停止录制
ppt对操作的录制很有限,例如更改文本框位置、字体改变等动作不能被捕捉到
宏代码如下:
Sub yw()
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 = "楷体_GB2312" '更改为需要的字体
.Size = 18 '改为所需的文字大小
If .Color.RGB = RGB(255, 120, 0) Then
oTxtRange.Font.Color.RGB = RGB(Red:=0, Green:=0, Blue:=0) '改成想要的文字颜色,用RGB参数表示
End If
End With
End If
Next
Next
End Sub
RGB颜色查询对照表