|
给一个实例,你可照葫芦画瓢。
代码如下:
Sub 添加形状()
For Each sld In ActivePresentation.Slides
For Each shp In sld.Shapes
If shp.Type = 1 Then shp.Delete
Next
Next
Set sld = Nothing
For i = 1 To ActivePresentation.Slides.Count
Set sld = ActivePresentation.Slides(i)
With sld.Shapes.AddShape(i, 30 * i, 20 * i, 300 + i * 8, 50 + i * 15)
Randomize
.Fill.BackColor.RGB = RGB(Int(Rnd * 255), Int(Rnd * 255), Int(Rnd * 255))
.Fill.ForeColor.RGB = Choose(i Mod 5 + 1, vbMagenta, vbGreen, vbBlue, vbCyan, vbYellow, vbRed)
With .TextFrame.TextRange
.Text = "我是第" & i & "个性状"
.Font.NameFarEast = Choose(i Mod 5 + 1, "宋体", "黑体", "华文新魏", "华文彩云", "华文细黑")
.Font.Size = 20 + 4 * i
.Font.Color.RGB = Choose(i, vbRed, vbGreen, vbBlue, vbYellow, vbCyan, vbMagenta)
End With
With .Glow
.Color.RGB = Choose(i Mod 5 + 1, vbGreen, vbBlue, vbCyan, vbYellow, vbRed)
.Radius = 0.1 * i
End With
With .ThreeD
.BevelTopDepth = 20 * i
.ExtrusionColor.RGB = Choose(i Mod 5 + 1, vbCyan, vbBlue, vbYellow, vbRed, vbGreen)
End With
End With
Next
End Sub
见附件。
test.zip
(44.59 KB, 下载次数: 10)
|
|