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!
I get a Run time error '424' Object required error when I try that. – Gary Petersen – 2009-08-19T22:49:25.707