本文介绍了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表的边框
发布评论