Sub Text()
On Error Resume Next
Dim oPres As Presentation
Set oPres = Application.ActivePresentation
Dim oSlide As Slide
Dim oShape As Shape
Dim tr As TextRange
Dim sText As String
Dim i As Long, j As Long
Dim fjd As Integer
'循环每页幻灯
For i = 1 To oPres.Slides.Count
Set oSlide =
oPres.Slides.Item(i)
fjd =
oSlide.Shapes.Count
'判断ppt里有2个文本框
If fjd = 2 Then
For j = 1 To 1
Set oShape = oSlide.Shapes.Item(j)
With oShape
.Left =
50
.Top =
20
.Width =
570
End With
If oShape.TextFrame.HasText = msoTrue Then
Set tr =
oShape.TextFrame.TextRange
tr.Font.NameAscii = "黑体"
tr.Font.NameFarEast = "黑体"
tr.Font.Size = 28
tr.Font.Color.SchemeColor = ppBackground
Set tr =
Nothing
End If
Set oShape = Nothing
Next
For j = 2 To 2
Set oShape = oSlide.Shapes.Item(j)
With oShape
.Left =
50
.Top =
100
.Width =
570
End With
If oShape.TextFrame.HasText = msoTrue Then
Set tr =
oShape.TextFrame.TextRange
tr.Font.NameAscii = "黑体"
tr.Font.NameFarEast = "黑体"
tr.Font.Size = 26
tr.Font.Color.RGB = RGB(Red:=255, Green:=192, Blue:=0)
Set tr = Nothing
End If
Set oShape = Nothing
Next
Else
For j = 1 To 1
Set oShape = oSlide.Shapes.Item(j)
With oShape
.Left =
50
.Top =
100
.Width =
570
End With
If oShape.TextFrame.HasText = msoTrue Then
Set tr =
oShape.TextFrame.TextRange
tr.Font.NameAscii = "黑体"
tr.Font.NameFarEast = "黑体"
tr.Font.Size = 26
tr.Font.Color.RGB = RGB(Red:=255, Green:=192, Blue:=0)
Set tr = Nothing
End If
Set oShape = Nothing
Next
End If
Set oSlide =
Nothing
Next
Set oPres = Nothing
End Sub
Sub Text()
On Error Resume Next
Dim oPres As Presentation
Set oPres = Application.ActivePresentation
Dim oSlide As Slide
Dim oShape As Shape
Dim tr As TextRange
Dim sText As String
Dim i As Long, j As Long
'循环每页幻灯
For i = 1 To oPres.Slides.Count
Set oSlide =
oPres.Slides.Item(i)
For j = 1 To 1
Set oShape = oSlide.Shapes.Item(j)
With oShape
.Left =
50
.Top =
20
.Width =
570
End With
Set oShape = Nothing
Next
For j = 2 To 2
Set oShape = oSlide.Shapes.Item(j)
With oShape
.Left =
50
.Top =
200
.Width =
570
End With
Set oShape = Nothing
Next
Set oSlide =
Nothing
Next
Set oPres = Nothing
End Sub
加载中,请稍候......