![](/img/trans.png)
[英]Change the color of 1 cell in every table with Powerpoint VBA
[英]Use VBA to change the internal margin and/or number format of a PowerPoint table cell
我有一个VBA循环,循环通过PowerPoint表的选定单元格来更新格式。 以下几行非常有用:
With objTable.Rows(the_row).Cells(the_col).Shape.TextFrame.TextRange.Font
.Size = 12
.Color = RGB(0, 0, 102)
End With
With objTable.Rows(the_row).Cells(the_col).Shape.TextFrame
.VerticalAnchor = msoAnchorMiddle
End With
我无法找到修改数字格式的语法(更改小数位数,添加逗号等)并更改单元格的内部边距(我可以通过右键单击手动执行 - >格式化形状 - >文本框 - >内部边距)。 通常我使用记录宏选项来获得详细的语法,但我没有在PowerPoint中看到该选项。
With objTable.Rows(the_row).Cells(the_col).Shape.TextFrame
'Internal margin:
.MarginLeft = 'value goes here
.MarginRight = 'value goes here
.MarginTop = 'value goes here
.MarginBottom= 'value goes here
'number Format:
.TextRange.text = Format(1000, "#,##0.00") 'replace 1000 with your value
end with
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.