Thread: Macro problem
View Single Post
 
Old 08-12-2014, 11:14 PM
gmayor's Avatar
gmayor gmayor is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,142
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Returning to the original premise which was, I believe, to paste unformatted text into the body of an e-mail message, the code you need for that is as follows. Note that it only works if the cursor is in the body of the message.

Code:
Sub PasteUnfText()
On Error GoTo ErrHandler
If TypeName(ActiveWindow) = "Inspector" Then
    If ActiveInspector.IsWordMail And ActiveInspector.EditorType = olEditorWord Then
        ActiveInspector.WordEditor.Application.Selection.PasteSpecial DataType:=2        ' wdPasteText
    End If
End If
Exit Sub
ErrHandler:
Beep
End Sub
Once you have determined that the ActiveInspector is the Word editor, then the process is very similar to using VBA in Word.

Graham Mayor MS MVP(Word)
www.gmayor.com
Reply With Quote