Paste formatted text (bold, underlined and in quotes)

Bamerand

Member
Outlook version
Outlook 2013 32 bit
Email Account
Exchange Server
Dear Outlook / VBA experts,

I am using the following code (googled it) to paste un-formatted text to email message. How can I change it, so the text pasted is bold, underlined and in quotes? Here is an instance for example in the next line. The text - antelope was darker - is pasted, once pasted it is bold, underlined and in quotes. How can this be achieved?

The "antelope was darker", leaner and more thoroughly cooked.

Screenshot.png

Private Sub Paste_Special_Unformatted()
Dim objDoc As Word.Document
Dim objSel As Word.Selection


On Error Resume Next
' get a Word.Selection from the open Outlook item
Set objDoc = Application.ActiveInspector.WordEditor
Set objSel = objDoc.Windows(1).Selection
' now do what you want with the Selection

objSel.PasteSpecial Link:=False, DataType:=wdPasteText

Set objDoc = Nothing
Set objSel = Nothing

End Sub
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
You'll need to format after pasting. Formatting using a macro is easy - although it might be harder if you need to find text within the pasted text. A simple sample macro us here - Use Word Macro to Apply Formatting to Email - there is a second same that shows how to do what you need, more or less, but again, getting the text within the paste is going to be the more difficult part.
 
Top