向所有桌子添加边框颜色PowerPoint VBA
试图在PowerPoint和失败的所有表中添加边框颜色。我不太擅长。
Sub SetTableBorder()
Dim oShp As Shape
Dim oTbl As Table
Dim oSld As Slide
For Each oSld In ActivePresentation.Slides
For Each oShp In oSl.Shapes
If oShp.HasTable Then
With oShp.Table
.Borders(ppBorderTop).ForeColor.RGB = RGB(235,186,182)
.Borders(ppBorderBottom).ForeColor.RGB = RGB(235,186,182)
.Borders(ppBorderLeft).ForeColor.RGB = RGB(235,186,182)
.Borders(ppBorderRight).ForeColor.RGB = RGB(235,186,182)
End With
End If
Next oShp
Next oSld
End Sub
Trying to add a border color to all tables in Powerpoint and failing. I'm not very good at this.
Sub SetTableBorder()
Dim oShp As Shape
Dim oTbl As Table
Dim oSld As Slide
For Each oSld In ActivePresentation.Slides
For Each oShp In oSl.Shapes
If oShp.HasTable Then
With oShp.Table
.Borders(ppBorderTop).ForeColor.RGB = RGB(235,186,182)
.Borders(ppBorderBottom).ForeColor.RGB = RGB(235,186,182)
.Borders(ppBorderLeft).ForeColor.RGB = RGB(235,186,182)
.Borders(ppBorderRight).ForeColor.RGB = RGB(235,186,182)
End With
End If
Next oShp
Next oSld
End Sub
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,更正错字:OSL.Shapes - > OSLD.形状
接下来,在此(以及理想情况下所有其他)模块中的所有subs/函数上面添加选项。这样可以阻止这种事情咬你。
接下来,您想使用表的.rows(1).cells.borders(ppbordertop)及其各种属性来设置顶级
边框桌子的底部边框。
然后,.columns(1).cells ...属性...设置左边框。
等等。
First, correct the typo: oSl.Shapes --> oSld.Shapes
Next, add Option Explicit above all the subs/functions in this (and ideally all other) module. That'll prevent this kind of thing from biting you.
Next, you want to work with the table's .Rows(1).Cells.Borders(ppBorderTop) and its various properties to set the top border,
Something like .Rows(.Rows.Count).Cells ... etc to set the bottom border for the table.
Then similarly, .Columns(1).Cells ... properties ... to set the left border.
And so on.