VBA & Macro Problems

Apply a Word Paragraph Style with VBA Without Losing Bold Formatting

Huma Ashraf ChHuma Ashraf Ch Nov 22, 2026 870 views

Question details

Apply a paragraph style in Word while retaining existing character formatting such as bold and italic.

Apply a Word Paragraph Style with VBA Without Losing Bold Formatting
Product
Microsoft Word
Device & OS
not provided
Scenario
A user is formatting text pasted from a shared document and wants to apply a paragraph style without losing character formatting.
Observed behavior
Applying a paragraph style can overwrite existing direct character formatting.
Before you start

Use desktop Word and check that the paragraph style you want already exists in the document. The example uses a style named Menu; replace that name in the macro if your style has a different name.

Solution 1Recommended

Save and Restore Character Formatting with a Word VBA Macro

Use this macro to apply a paragraph style to the first selected paragraph while restoring its original character font formatting.

The macro saves a duplicate of each character's Font object, applies the paragraph style, and then restores the saved formatting. It excludes the final paragraph mark.

Restoring the full font formatting can also override font settings from the new paragraph style, such as its size or typeface. The approach may be slow for long paragraphs and may not preserve every character-style scenario.

1
Open the VBA editor

In desktop Word, open Developer > Visual Basic. If the Developer tab is hidden, enable it in Word's ribbon settings.

2
Insert the macro

In the VBA editor, select the document's project, choose Insert > Module, and paste this code: Sub ApplyStyleKeepFont() Dim savedFonts() As Font Dim para As Paragraph Dim i As Long Dim n As Long Set para = Selection.Paragraphs(1) n = para.Range.Characters.Count - 1 If n > 0 Then ReDim savedFonts(1 To n) For i = 1 To n Set savedFonts(i) = para.Range.Characters(i).Font.Duplicate Next i End If para.Style = "Menu" For i = 1 To n para.Range.Characters(i).Font = savedFonts(i) Next i End Sub

3
Choose the paragraph and style

Replace "Menu" in the code with the exact name of an existing paragraph style if needed. Return to the document and place the cursor in the paragraph you want to format.

4
Run and check the result

Open Developer > Macros, select ApplyStyleKeepFont, and click Run. Check the paragraph's bold, italic, and other font formatting after the style is applied.

5
Save the macro if needed

To keep the macro in the document, choose File > Save As and save it as a Word Macro-Enabled Document (.docm).

Save and Restore Character Formatting with a Word VBA Macro
Scope of the macro: Only the first paragraph in the selection is processed. Test the result carefully if the text uses character styles or is inside a table.
Free Microsoft Office alternative

Format Word Documents with WPS Writer

WPS Office is a free, lightweight Office alternative with a familiar interface for editing and formatting documents. Open compatible Word files in WPS Writer to make the transition easier; it does not fix or replace this Microsoft Word VBA macro.

Apply paragraph styles and edit bold or italic text in WPS WriterOpen and edit Microsoft Word DOC and DOCX filesUse familiar document-formatting toolsWork with a free, lightweight Office alternative
microsoft office alternative - wps office

Frequently Asked Questions

Why did applying a paragraph style change my bold text?

A paragraph style can change character formatting as well as paragraph settings. The macro saves each character's font formatting before applying the style and restores it afterward.

Can the macro format several selected paragraphs at once?

No. It uses Selection.Paragraphs(1), so it processes only the first selected paragraph. Place the cursor in another paragraph and run it again for that paragraph.

What if my paragraph style is not named Menu?

In the VBA editor, replace "Menu" in the line para.Style = "Menu" with the exact name of your existing paragraph style.

Will the new style's font still be applied?

Not necessarily. The macro restores the full saved Font object for each character, which can override the new style's font, size, or other character settings.

How can I keep the macro in my document?

Choose File > Save As and select Word Macro-Enabled Document (.docm). Run macros only when you trust their source.