如何在ppt上写VBA?
word和excel都能录制,因此会方便很多。但是只从2013版开始就没有了录制宏的功能。
我想了解一下,应该怎么在所有幻灯片里面都添加一个形状呢? 给一个实例,你可照葫芦画瓢。
代码如下:
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
见附件。
你是怎么学习ppt的vba编程的啊? 从自己的工作实际出发,以实用为主,上网搜索示例,加以改造,并以实例所关涉的知识为抓点,延及其他,逐步扩散。
页:
[1]