使用 VBA 在 Powerpoint Table 中设置自定义缩进和悬挂

Set Custom Indentation and Hanging in Powerpoint Table using VBA

我想在 powerpoint 中为 table 中的段落添加项目符号,然后在文本前设置缩进:0.13 和 Special/Hanging 该项目符号点的缩进 0.13。我能够做到这一点,但问题是,如果 table 单元格中有多个段落,则所有段落都将按给定值进行处理。

ActiveWindow.Selection.ShapeRange.TextFrame.Ruler.Levels(1).LeftMargin = 72 * 0.13 * 1

我正在使用它,它适用于整个单元格,而不是仅适用于特定段落。

ActiveWindow.Selection.TextRange.Paragraphs.IndentLevel = 3

我也试过使用 IndentLevel,它只适用于那个特定的段落,但我没有得到 0.13 的值用于文本和悬挂之前的缩进。有没有办法做到这一点? 我一整天都被困在这个问题上。

您需要按如下方式迭代段落:

Option Explicit

' ********************************************************************************
' PowerPoint VBA Macro written by Jamie Garroch of http://YOUpresent.co.uk/
' Purpose : Set the Hanging ruler spacing for the selected text range
' Inputs  : None
' Outputs : None
' ********************************************************************************
Sub SetBulletHanging()
  Dim x As Long
  With ActiveWindow.Selection.TextRange2
    For x = 1 To .Paragraphs.Count
      With .Paragraphs(x).ParagraphFormat
        .FirstLineIndent = -72 * 0.13 * 1
      End With
    Next
  End With
End Sub