我有一个 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
Run Code Online (Sandbox Code Playgroud)
我无法找到修改数字格式(更改小数位数、添加逗号等)和更改单元格内部边距(我可以通过右键单击 -> 格式手动执行此操作)的语法形状 -> 文本框 -> 内部边距)。通常我使用记录宏选项来获取详细的语法,但我在 PowerPoint 中没有看到该选项。
小智 5
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
Run Code Online (Sandbox Code Playgroud)