• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Macro - paste as plain text

ofw62

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
POP3
#1
Up front: I am -not- an expert on macros/VBA, or, better said, I have no knowledge of it at all.

I want to paste clipboard text as unformatted, plain text. Regretfully the VBA code from a recorded macro that I use in Excel
could not be used.

Found an old thread (Outlook 2007 Macro: Paste - Paste Special - Unformatted Text aug.22, 2009) dealing with this issue.

Macro reading:

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

This works fine.

Q: Is it possible to assign a hotkey to this?
(like ctrl-g, or ctrl-t)

SnagIt-24052018 073347.png
 
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
#2
No, not in Outlook like you can in Word... you can add a button for it to the quick access toolbar or ribbon - the resulting shortcut will either be Alt+nn (position in from left) or a shortcut such as Alt+HYA if you add it to the ribbon - the shortcut is assigned based on the ribbon and position on the ribbon - they need to be after the default buttons to have a shortcut assigned.
 

ofw62

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
POP3
#3
Many thanks Diane.
Added a button to the quick access toolbar. That's fine as well.

Oh, BTW, when doing in a fresh install of Office, I assume I have to create the macro again?
Or is it saved in some file?
Optionally Excel stores macros into a file, personal.xlsb. After restoring the file into C:\Users\...blabla...\Excel\XLSTART\ folder
they are available upon next launch of Excel.

Thanks again.
 

Similar threads