I'd like to assign a macro in Outlook 2007 to a Toolbar button that would execute the equivalent of these clicks when there is formatted text in the Windows clipboard:

  1. Click the Paste icon by the bottom arrow
  2. Click the Paste Special link.
  3. Click the Unformatted Text link.

I have similar macros in Excel 2007 and Word 2007 but haven't been able to get one to work in Outlook 2007 / VBA. What would the VBA code for such a macro be?


With lots of help from author Sue Mosher, I have finally managed to get a macro working on Outlook 2007 to automate the mouse clicks of Paste – Paste Special – Unformatted Text! WOO-HOO!!!!

Most of what I cut and paste into Outlook email messages is formatted. Pasting with CTRL-V or by clicking the Paste button keeps that formatting intact. Clicking Paste – Paste Special – Unformatted Text isn’t a big deal, but it takes a couple of seconds every time I do it – and I do it a LOT. So this little thing will be a timesaver for me.

The VBA subroutine:

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

To get it to work, I also needed to open the VBA editor in Outlook 2007, click Tools – References, and enable the reference for Microsoft Word 12.0 Object Library. I then linked the macro to a custom button in the QAT toolbars for creating new messages and replies and it worked just fine!

I may have mentioned this before, but WOO-HOO!!!!

Thank you, Sue!


It should be the same as in Word 2007:

    Sub FormatText()
' FormatText Macro
    Selection.PasteAndFormat (wdFormatPlainText)
    Selection.PasteSpecial Link:=False, DataType:=20, Placement:=wdInLine, _
End Sub
  1. In Outlook, point to Macro on the Tools menu, and then click Visual Basic Editor.
  2. In the Project window, double-click the module you want to contain the macro.
  3. On the Insert menu, click Procedure.
  4. In the Name box, type a name for the macro and click OK. Type the code you want to run in the body of the subroutine (or copy/paste it from Word)
  • I get a Run time error '424' Object required error when I try that. – Gary Petersen Aug 19 '09 at 22:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.