向所有桌子添加边框颜色PowerPoint VBA

发布于 2025-01-28 14:34:47 字数 632 浏览 1 评论 0原文

试图在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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

北城半夏 2025-02-04 14:34:47

首先,更正错字: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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文