如何通过计数将形状添加到各部分之间的幻灯片
我正在尝试在各部分之间的幻灯片中添加形状(将部分编号作为形状中的文本),但到目前为止我只知道如何找到具有该布局名称的形状。我想我应该在某个地方设置一个计数器,但我还没有找到方法。 理想情况下,我会对这些部分进行计数,然后将值传递给要开发的宏的其他部分。
Sub Navigator()
Dim oSlide As Slide
Dim oSlideNavigator As Slide
Dim oShapeNavigator As Shape
Dim Section_N As Integer
For Each oSlide In ActivePresentation.Slides
If oSlide.CustomLayout.Name = "Section" Then
Set oShapeNavigator = oSlide.Shapes.AddTable(2, 2, Left:=10, Top:=10, Width:=200, Height:=2)
oShapeNavigator.Fill.ForeColor.RGB = RGB(255, 128, 128)
End If
Next
End Sub
I am trying to add shapes to the slides between sections (with the section number as text in the shape) but I know so far only how to find those with that layout name. I think I should setup a counter somewhere but I have not found a way how.
Ideally I would count the sections and then pass the value later to other parts of the macro to be developed.
Sub Navigator()
Dim oSlide As Slide
Dim oSlideNavigator As Slide
Dim oShapeNavigator As Shape
Dim Section_N As Integer
For Each oSlide In ActivePresentation.Slides
If oSlide.CustomLayout.Name = "Section" Then
Set oShapeNavigator = oSlide.Shapes.AddTable(2, 2, Left:=10, Top:=10, Width:=200, Height:=2)
oShapeNavigator.Fill.ForeColor.RGB = RGB(255, 128, 128)
End If
Next
End Sub
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我使用布局名称“Section”为每张幻灯片设置计数器,然后将值发送到表以添加到与找到的值不同的值中。所以一个简单的
Else
就达到了目的。I Set the counter for each slide with Layout Name "Section", then sent the value to the table to be added in those different from those found. So a simple
Else
did the trick.