Help!

Paste Special Unformatted Text in Outlook

 
  

Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Programming VBA RSS
Next:  Numbering inconsistency  
Author Message
Gary Petersen
External


Since: Mar 03, 2009
Posts: 2



PostPosted: Tue Mar 03, 2009 2:06 pm    Post subject: Paste Special Unformatted Text in Outlook
Archived from groups: microsoft>public>outlook>program_vba (more info?)

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
Back to top
Ken Slovak - [MVP - Outlo
External


Since: Oct 17, 2003
Posts: 3355



PostPosted: Wed Mar 04, 2009 9:26 am    Post subject: Re: Paste Special Unformatted Text in Outlook [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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
>
Back to top
Gary Petersen
External


Since: Mar 03, 2009
Posts: 2



PostPosted: Wed Mar 04, 2009 10:08 am    Post subject: Re: Paste Special Unformatted Text in Outlook [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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 - [MVP - Outlook]" wrote:

> 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.RemoveThis@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
> >
>
>
Back to top
Display posts from previous:   
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Programming VBA All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum