I am trying to set custom value for indentation and hanging for a cell in table in powerpoint using VBA. I am using the code shown below.
tb.Cell(1,1).Shape.TextFrame.Ruler.Levels(1).LeftMargin = 72 * 0.13
tb.Cell(1,1).Shape.TextFrame.Ruler.Levels(1).FirstMargin = 0
Here tb is the table. This is working fine if the cell is not empty. But if the cell is empty the values don't change. Is there a way to achieve this.
You need to set the paragraph formatting for text as opposed to cell margins. Use these:
With tb.Cell(1,1).Shape
' Before
.TextFrame2.TextRange.ParagraphFormat.LeftIndent = 72 * 0.13
' Hanging
.TextFrame2.TextRange.ParagraphFormat.FirstLineIndent = 0
End With
You can set it to be different for each paragraph as follows:
.TextFrame2.TextRange.Paragraphs(lStart, lLength).ParagraphFormat.LeftIndent