VBA & Macro Problems

Apply Small Caps in PowerPoint with a VBA Macro

Algirdas JasaitisAlgirdas Jasaitis Nov 20, 2026 868 views

Question details

The user wants a VBA macro that applies Small Caps to selected text or text in a selected text box.

Product
Microsoft PowerPoint
Device & OS
not provided
Scenario
The user wants a convenient command for formatting presentation text as Small Caps.
Observed behavior
The desired result is selected text displayed in Small Caps without repeatedly opening the Font dialog.
Before you start

Open the presentation in a desktop version of PowerPoint that supports VBA. Save it as a macro-enabled presentation (.pptm) or macro-enabled template (.potm) so the macro can be retained.

Solution 1Recommended

Create a Small Caps macro and add it to the Quick Access Toolbar

Use this macro to apply Small Caps to a text selection or to all text in one selected text box.

1
Open the VBA editor

In desktop PowerPoint, press Alt+F11 to open the Visual Basic Editor. Select the presentation or template project in the Project Explorer.

2
Insert the macro

Choose Insert > Module and paste this code: Sub MySmallCaps() Dim sel As Selection Set sel = ActiveWindow.Selection If sel.Type = ppSelectionText Then sel.TextRange2.Font.SmallCaps = msoTrue ElseIf sel.Type = ppSelectionShapes Then If sel.ShapeRange.Count = 1 Then If sel.ShapeRange(1).HasTextFrame = msoTrue Then If sel.ShapeRange(1).TextFrame2.HasText = msoTrue Then sel.ShapeRange(1).TextFrame2.TextRange.Font.SmallCaps = msoTrue End If End If End If End If End Sub

3
Save and run the macro

Save the file as .pptm or .potm. In PowerPoint, select the text or one text box, open View > Macros, select MySmallCaps, and choose Run.

4
Add a toolbar shortcut

Open File > Options > Quick Access Toolbar. Under Choose commands from, select Macros, choose MySmallCaps, click Add, and then click OK.

Create a Small Caps macro and add it to the Quick Access Toolbar
Macro availability and security: The macro must be available in an open presentation or template to run. Saving it in a template does not necessarily make it globally available in every presentation. Enable macros only in files you trust.
Free Microsoft Office alternative

Work with PowerPoint presentations in WPS Office

WPS Office is a free, lightweight alternative with a familiar interface for working with presentations and other Office files. Its format compatibility can make switching between Office suites easier, though it does not fix PowerPoint's VBA settings or guarantee that PowerPoint macros will run.

Create and format presentation slides in WPS Presentation.Open and edit Microsoft PowerPoint formats such as PPT and PPTX.Use a familiar interface for common presentation tasks.Work with a free, lightweight Office alternative.
microsoft office alternative - wps office

Frequently Asked Questions

Does the macro format the whole text box or just selected text?

If you select text within a text box, it formats only that selection. If you select one text box as a shape, it formats all the text in that box.

Why can't I find the macro after reopening my presentation?

Make sure you saved the code in a macro-enabled .pptm presentation or .potm template and that the file containing the macro is open. A standard .pptx file cannot retain VBA macros.

Can I use this VBA macro in PowerPoint for the web?

No. Open the file in a desktop version of PowerPoint that supports VBA to edit and run the macro.

Will a macro saved in a template be available in every presentation?

Not necessarily. The template or another file containing the macro must be available to PowerPoint; saving a macro in a template alone does not guarantee global availability.