Guilherme Matheus
Guilherme Matheus

Reputation: 595

How to clear all formatting from body text in Outlook

I didn't find this question anywhere, so I don't if it's even possible because we can't record macro in Outlook.

But, I'd like to clear all text formatting in my e-mail that I'm replying by a macro in Outlook.

Since I'm using olReply.HTMLBody and building all the body with a Loop and some if and elses, I couldn't format the body in it.

Example: Clear all text formatting - Outlook

Thanks!

Upvotes: 0

Views: 665

Answers (1)

0m3r
0m3r

Reputation: 12499

I'm not sure how your code looks like but here is quick example using ClearFormatting Method Make sure you click Reply or ReplyAll and select the text you are trying to format then run the code

Option Explicit
Public Sub Exmple()
    Dim wDoc As Word.Document
    Dim rngSel As Word.selection

    If Application.ActiveInspector.EditorType = olEditorWord Then
        Set wDoc = Application.ActiveInspector.WordEditor ' use WordEditor
        Set rngSel = wDoc.Windows(1).selection ' Current selection

        rngSel.ClearFormatting

    End If

    Set wDoc = Nothing
End Sub

Upvotes: 1

Related Questions