VBA:设置Powerpoint表的边框

编程入门 行业动态 更新时间:2024-10-10 09:23:56
本文介绍了VBA:设置Powerpoint表的边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我尝试为现有的Powerpoint表设置边框.它运行得很好(并且行和列号作为测试数据插入到每个单元格中),但是边框没有出现.我究竟做错了什么?

I try to set a border to a existing powerpoint table. It runs through fine (and the row and column number is inserted in each cell as test data), but the border just does not appear. What am I doing wrong?

For i = 1 To myPresentation.Slides(w).Shapes(tableName).Table.Rows.Count For j = 1 To myPresentation.Slides(w).Shapes(tableName).Table.Columns.Count myPresentation.Slides(w).Shapes(tableName).Table.Cell(i, j).Shape.TextFrame.TextRange.Text = "R:" & i & " C:" & j With myPresentation.Slides(w).Shapes(tableName).Table.Cell(i, j) .Borders(ppBorderTop).DashStyle = msoLineSolid .Borders(ppBorderBottom).DashStyle = msoLineSolid .Borders(ppBorderLeft).DashStyle = msoLineSolid .Borders(ppBorderRight).DashStyle = msoLineSolid .Borders(ppBorderTop).ForeColor.RGB = RGB(255, 110, 0) .Borders(ppBorderBottom).ForeColor.RGB = RGB(255, 110, 0) .Borders(ppBorderLeft).ForeColor.RGB = RGB(255, 110, 0) .Borders(ppBorderRight).ForeColor.RGB = RGB(255, 110, 0) .Borders(ppBorderBottom).Weight = 1 .Borders(ppBorderTop).Weight = 1 .Borders(ppBorderLeft).Weight = 1 .Borders(ppBorderRight).Weight = 1 .Borders(ppBorderBottom).Visible = msoTrue .Borders(ppBorderTop).Visible = msoTrue .Borders(ppBorderLeft).Visible = msoTrue .Borders(ppBorderRight).Visible = msoTrue End With Next j Next i

推荐答案

创建一个幻灯片演示文稿,并仅在其中添加两个表格.然后运行以下代码:

Create a single slide presentation and add only two tables on it. Then run this code:

Public Sub TestMe() Dim myTable As Table Dim sh As Shape For Each sh In ActivePresentation.Slides(1).Shapes Set myTable = sh.Table myTable.Cell(1, 1).Borders(ppBorderTop).ForeColor.RGB = RGB(255, 110, 0) Next sh End Sub

应该可以.从那里尝试进一步构建.

It should work. From there try to build a bit further.

更多推荐

VBA:设置Powerpoint表的边框

本文发布于:2023-10-31 10:11:37,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1545774.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:边框   VBA   Powerpoint

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!