Monday, March 24, 2025

Clear formatting from selected text using keyboard shortcuts in Word

 To clear formatting from selected text using keyboard shortcuts:

  • Press Ctrl + Spacebar to clear character formatting only (such as bold, font and font size) from selected text.
  • Press Ctrl + Q to clear paragraph formatting only (such as indents and line spacing) from selected text.
  • Press Ctrl + Shift + N to reapply the Normal style to selected text.

Sub ResetParagraphFormat()
'
' Reset Selection Paragraph Formatting
'
'
    With Selection.ParagraphFormat
        .Reset
        .LeftIndent = CentimetersToPoints(0)
        .RightIndent = CentimetersToPoints(0)
        .SpaceBefore = 0
        .SpaceBeforeAuto = False
        .SpaceAfter = 0
        .SpaceAfterAuto = False
        .LineSpacingRule = wdLineSpaceSingle
        .Alignment = wdAlignParagraphJustify
        .WidowControl = False
        .KeepWithNext = False
        .KeepTogether = False
        .PageBreakBefore = False
        .NoLineNumber = False
        .Hyphenation = True
        .FirstLineIndent = CentimetersToPoints(0)
        .OutlineLevel = wdOutlineLevelBodyText
        .CharacterUnitLeftIndent = 0
        .CharacterUnitRightIndent = 0
        .CharacterUnitFirstLineIndent = 0
        .LineUnitBefore = 0
        .LineUnitAfter = 0
        .MirrorIndents = False
        .TextboxTightWrap = wdTightNone
        .CollapsedByDefault = False
    End With
End Sub


Sub SelectionClearFormatting()
'
' Clear All Formatting
'
    With Selection
        .ClearFormatting
    End With
End Sub
 

Sub ResetParagraph()
' Removes manual paragraph formatting (formatting not applied using a style).
' If you manually right align a paragraph and the underlying style has a different alignment,
' the Reset method changes the alignment to match the formatting of the underlying style.
    Selection.Paragraphs.Reset
End Sub