First, get a reference to the Paragraphs
of the TextRange2
, as each bulleted item is a paragraph (really a TextRange2
).
Dim pres As Presentation
Set pres = Application.ActivePresentation
Dim slide As slide
Set slide = pres.Slides(2)
Dim shapes As shapes
Set shapes = slide.shapes
Dim textShape As Shape
Set textShape = shapes(2)
Dim textFrame As TextFrame2
Set textFrame = textShape.TextFrame2
Dim textRng As TextRange2
Set textRng = textFrame.textRange
Dim p As TextRange2
Set p = textRng.Paragraphs
SetIndent 1, p.Item(1)
SetIndent 2, p.Item(2)
SetIndent 2, p.Item(3)
SetIndent 1, p.Item(4)
The last four lines call a function that encapsulates the logic of setting the indent "level," which affects the style of bullets and text, and the actual indent of the bullets and text:
Private Function SetIndent(ByVal level As Integer, ByRef p As TextRange2)
p.ParagraphFormat.IndentLevel = level
p.ParagraphFormat.FirstLineIndent = 40
p.ParagraphFormat.LeftIndent = level * 40
End Function
You could certainly refactor this to meet your needs -- like passing the indent factor (I hardcoded it as 40, but your mileage may vary).