Paste Special Unformatted Text in Outlook

G

Gary Petersen

In Word, the macro for paste special-unformatted text is pretty simple, like
this:

Sub PasteUnformatted()
Selection.PasteSpecial Link:=False, DataType:=wdPasteText
End Sub

I'd like to do this in Outlook 2007 so I could link the VBA macro to a
button. This script gives me an object required error. Can anyone help out
with the VBA code for this? I've searched the forum here and the Internet in
general without finding a solution.

Thanks,
 
K

Ken Slovak - [MVP - Outlook]

When run in Word the Selection object is known, Outlook has no idea what
you're talking about. You must fully qualify that reference, depending on
what the parent of the Selection is (Application, Pane, Global, Window,
whatever).

In Outlook the Inspector.WordEditor object (Inspectors are the windows you
use to view open Outlook items) is a Word.Document object.
Inspector.WordEditor.Parent is Word.Application. Using that knowledge you
can then get the Word document and application and use those, with the Word
object model.

The WordMail used in Outlook 2007 isn't the full Word EXE, it's a private
DLL to Outlook. So some things aren't available. What you want may or may
not be doable, given that.

There should be some information on the limitations of Word coding for
Outlook 2007 WordMail at www.outlookcode.com.
 
G

Gary Petersen

I will check into the site you suggested, Ken. I'm not sure whether it
matters, but what I want the code to do is paste the contents of the
clipboard into the message body pane at the location where the cursor is
located as unformatted text.

Thanks,
--
Gary Petersen



Ken Slovak - said:
When run in Word the Selection object is known, Outlook has no idea what
you're talking about. You must fully qualify that reference, depending on
what the parent of the Selection is (Application, Pane, Global, Window,
whatever).

In Outlook the Inspector.WordEditor object (Inspectors are the windows you
use to view open Outlook items) is a Word.Document object.
Inspector.WordEditor.Parent is Word.Application. Using that knowledge you
can then get the Word document and application and use those, with the Word
object model.

The WordMail used in Outlook 2007 isn't the full Word EXE, it's a private
DLL to Outlook. So some things aren't available. What you want may or may
not be doable, given that.

There should be some information on the limitations of Word coding for
Outlook 2007 WordMail at www.outlookcode.com.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top