Open elthombre opened 11 months ago
Hi @elthombre,
Sorry for the delayed response!
The Id you're looking for is "TableCellMarginsGallery", however that won't actually work for ExecuteMso. The "Narrow" option is inside of the "Cell Margins" gallery, which isn't accessible from VBA (as far as I can tell). However, you can still change the margins of a cell through VBA. Given a Cell object:
Dim myCell as Cell
...
myCell.Shape.TextFrame.MarginLeft = 3.6 ' 0.05 inches in Points = 0.05 * 72 = 3.6
myCell.Shape.TextFrame.MarginTop = 3.6
myCell.Shape.TextFrame.MarginRight = 3.6
myCell.Shape.TextFrame.MarginBottom = 3.6
Setting all margins to 3.6 points will give you the same result as selecting "Narrow".
When you have a table selected, you can use ActiveWindow.Selection.ShapeRange.Table
to access the Table from VBA. From there, you can access the cells. See https://learn.microsoft.com/en-us/office/vba/api/powerpoint.table for more details.
Similarly, you can also set the Font Size:
Dim myCell as Cell
...
myCell.Shape.TextFrame.TextRange.Font.Size = 17 ' Sets the font size for this cell to 17
I hope that helps!
Hi,
I want to do something like the following in PowerPoint:
Application..CommandBars.ExecuteMso ("PasteSourceFormatting")
but, when I have a table selected, to run the "Layout" -> "Cell Margins" -> "Narrow"
What is the idMSO / ExecuteMso tag with the 'Narrow' option?
Similarly, with table selected, on the "Home" tab, "Font" -> "Size" and the number?
Thanks