Others

How to Increase Paragraph Spacing by Points in PowerPoint VBA

Huda QurayshiHuda Qurayshi Oct 10, 2026 869 views

Question details

The user needs to increase the paragraph spacing before a text block by exactly 6 points using PowerPoint VBA, but the macro adds an unexpectedly large amount of space.

How to Increase Paragraph Spacing Before by Points in PowerPoint VBA
Product
PowerPoint
Device & OS
not provided
Scenario
Running a VBA macro to format text box paragraph spacing in a presentation.
Observed behavior
When adding a numerical value to SpaceBefore, the spacing jumps drastically because the system interprets the value as lines instead of points.
Before you start

Before modifying your macro, make sure you have your PowerPoint presentation open, the Developer tab enabled, and a backup of your current VBA code saved.

Solution 1Recommended

Explicitly Set LineRuleBefore to False in VBA

By setting the line rule property to False, you force PowerPoint to strictly interpret your spacing increment as points rather than lines.

In PowerPoint's VBA object model, paragraph spacing can be measured in either lines or points. If the LineRuleBefore property is True (or undefined), PowerPoint assumes the SpaceBefore value represents whole lines. Explicitly declaring it False ensures the measurement defaults to exact points.

1
Open the VBA Editor

Press Alt + F11 to open the VBA Editor in PowerPoint, and locate the module containing your text formatting macro.

2
Define TextRange and Variables

Ensure you have defined your text range properly, for example: Set textRange = ActiveWindow.Selection.ShapeRange(1).TextFrame2.TextRange, and declare a variable to hold the current spacing.

3
Turn Off the Line Rule

Insert the command textRange.ParagraphFormat.LineRuleBefore = False into your code immediately before making spacing adjustments.

4
Apply the Point Increment

Add your 6 points to the spacing property using the code: textRange.ParagraphFormat.SpaceBefore = currentSpacing + 6.

Explicitly Set LineRuleBefore to False in VBA
Selection Required: Make sure you actually have a text box or shape selected on your active slide when running this macro, otherwise the ShapeRange selection will throw an error.

Adjust Paragraph Spacing Easily in WPS Presentation

If you want to avoid complex VBA macros just to format text, WPS Presentation allows you to precisely adjust paragraph spacing in points directly from an intuitive and familiar interface.

  1. 1. Open Your Presentation: Launch WPS Presentation and open your slideshow.
  2. 2. Select the Text: Highlight the text box or specific paragraph you want to modify.
  3. 3. Open Paragraph Settings: Right-click the highlighted text and select 'Paragraph' from the context menu.
  4. 4. Apply Exact Spacing: Under the Spacing section, enter '6 pt' directly into the 'Before' field and click OK to apply the exact formatting instantly.
100% compatible with Microsoft PowerPoint (.pptx) formats and layouts.Precise, point-based paragraph formatting without writing any code.Free, lightweight, and incredibly fast to launch.
microsoft office alternative - wps office

Frequently Asked Questions

Why does my PowerPoint VBA paragraph spacing increment by massive amounts?

This usually happens because the LineRuleBefore property is either set to True or defaulting to True. When True, PowerPoint interprets any numerical value added to SpaceBefore as lines instead of points. For example, adding '6' adds 6 whole lines of space rather than 6 points.

Can I format point-based paragraph spacing without using VBA?

Yes. You can use the Slide Master view to pre-define the Spacing Before value in precise points for different text levels, which then applies globally across your presentation without needing a macro.

What is the difference between SpaceBefore and LineRuleBefore in PowerPoint?

SpaceBefore determines the numerical amount of space above a paragraph, while LineRuleBefore is a boolean (True/False) setting that dictates whether that numerical amount is measured in single lines (True) or exact points (False).