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.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
"Gary Petersen" <GaryPetersen DeleteThis @discussions.microsoft.com> wrote in message
news:A24DF503-9A73-4F02-B29A-A4C842425AD5@microsoft.com...
> 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,
> --
> Gary Petersen
>