Format paragraphs and bullets


Target Application: Microsoft PowerPoint

Programming Language: VBA

Let’s start. I will describe the next steps directly in the code as comments, so you don’t have to put the different parts back together at the end. This way, you can copy the entire code and run it in your PowerPoint application.
To run the macro, simply click on the green play button at the top of the VBA Editor (or press F5 on your keyboard).

' This macro is brought to you by DG | ELEVATE YOUR BUSINESS
' Author: Daniel Glöckner
' Last update: 2022/03/04
' Feel free to copy, use, adjust, and share

' Macro purpose: Format bullet points

Option Explicit ' Forces all variables to be explicitly declared


Sub ProcessSlides()
' Process all slides in presentation

' Define variables
Dim sld As Slide
Dim shp As Shape

' Process slides
For Each sld In ActivePresentation.Slides
    ' Process all shapes on slide
    For Each shp In sld.Shapes
        If shp.HasTextFrame Then
            FormatTextFrame shp
        End If
    Next shp
Next sld
End Sub

Private Function FormatTextFrame(shp)
' Format textframe

' Set indent: therefore we need TextFrame2
SetIndent shp.TextFrame2.TextRange

' Set indent level and spacing: therefore we need the regular TextFrame
' Ideally, you define the template for lists in the master layout
shp.TextFrame.TextRange.IndentLevel = 1

' Set spacing properties
shp.TextFrame.TextRange.ParagraphFormat.SpaceBefore = 0.25
shp.TextFrame.TextRange.ParagraphFormat.SpaceAfter = 0

' Format bullet points
FormatBullet shp.TextFrame.TextRange.ParagraphFormat.Bullet
End Function

Private Function SetIndent(tr)
' Set shape indent

tr.ParagraphFormat.FirstLineIndent = 0
tr.ParagraphFormat.LeftIndent = 2.5
End Function

Private Function FormatBullet(blt)
' Format bullet

' Set bullet type to unnumbered
' .Type = ppBulletUnnumbered
' Or define custom bullet symbol (character code and font can be looked up under:
' Bullets and Numbering > Customize)
blt.Character = 62
With blt.Font
    .Name = "Symbol"
    .Size = 10
    .Color = RGB(0, 0, 0)
End With
End Function