Help!

Outlook Macro - TypeText

 
  

Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Programming VBA RSS
Next:  How to track changes done on Outlook Calendar don..  
Author Message
Kooltou
External


Since: Mar 19, 2007
Posts: 3



PostPosted: Mon Mar 19, 2007 8:40 am    Post subject: Outlook Macro - TypeText
Archived from groups: microsoft>public>outlook>program_vba (more info?)

Hello!

I need to write a simple macro for Outlook 2007.

I would like it to simply insert several lines of text in the active message
window.

In Outlook/Word 2003, I used the selection.typetext command. What would I
use in Outlook 2007?

If it matters, the messages are (and need to be) plain text.

Thanks in advance!

Kind Regards,
Back to top
Sue Mosher [MVP-Outlook]
External


Since: Feb 11, 2005
Posts: 21627



PostPosted: Mon Mar 19, 2007 12:50 pm    Post subject: Re: Outlook Macro - TypeText [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

You should be able to use the same technique in Outlook 2007, since Word is always the editor.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Kooltou" <Kooltou.RemoveThis@discussions.microsoft.com> wrote in message news:5B44C891-85E4-4826-9F8B-1DAD92E9EC91@microsoft.com...
> Hello!
>
> I need to write a simple macro for Outlook 2007.
>
> I would like it to simply insert several lines of text in the active message
> window.
>
> In Outlook/Word 2003, I used the selection.typetext command. What would I
> use in Outlook 2007?
>
> If it matters, the messages are (and need to be) plain text.
>
> Thanks in advance!
>
> Kind Regards,
>
Back to top
Kooltou
External


Since: Mar 19, 2007
Posts: 3



PostPosted: Mon Mar 19, 2007 12:50 pm    Post subject: Re: Outlook Macro - TypeText [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hello!

Thanks for the reply.

Here was my previous code:

~~~~~~~~~
Sub InsertText()
Selection.TypeText Text:="Hello!"
End Sub
~~~~~~~~~

However, VBA does not now recognize the 'application' object, and I get an
error message "Object Required"

Thank you,

"Sue Mosher [MVP-Outlook]" wrote:

> You should be able to use the same technique in Outlook 2007, since Word is always the editor.
>
> --
> Sue Mosher, Outlook MVP
> Author of Configuring Microsoft Outlook 2003
> http://www.turtleflock.com/olconfig/index.htm
> and Microsoft Outlook Programming - Jumpstart for
> Administrators, Power Users, and Developers
> http://www.outlookcode.com/jumpstart.aspx
>
> "Kooltou" <Kooltou.TakeThisOut@discussions.microsoft.com> wrote in message news:5B44C891-85E4-4826-9F8B-1DAD92E9EC91@microsoft.com...
> > Hello!
> >
> > I need to write a simple macro for Outlook 2007.
> >
> > I would like it to simply insert several lines of text in the active message
> > window.
> >
> > In Outlook/Word 2003, I used the selection.typetext command. What would I
> > use in Outlook 2007?
> >
> > If it matters, the messages are (and need to be) plain text.
> >
> > Thanks in advance!
> >
> > Kind Regards,
> >
>
Back to top
Sue Mosher [MVP-Outlook]
External


Since: Feb 11, 2005
Posts: 21627



PostPosted: Mon Mar 19, 2007 5:50 pm    Post subject: Re: Outlook Macro - TypeText [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Your previous code was apparently a Word macro, not an Outlook macro. In an Outlook macro, you must first return a Word.Document object from the current item. For example:

Set objDoc = Application.ActiveInspector.WordEditor
Set objSel = objDoc.Windows(1).Selection
objSel.TypeText Text:="Hello!"

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Kooltou" <Kooltou RemoveThis @discussions.microsoft.com> wrote in message news:38EDA99E-C0FE-4150-82E5-2BA36F9C4466@microsoft.com...
> Hello!
>
> Thanks for the reply.
>
> Here was my previous code:
>
> ~~~~~~~~~
> Sub InsertText()
> Selection.TypeText Text:="Hello!"
> End Sub
> ~~~~~~~~~
>
> However, VBA does not now recognize the 'application' object, and I get an
> error message "Object Required"
>
> Thank you,
>
> "Sue Mosher [MVP-Outlook]" wrote:
>
>> You should be able to use the same technique in Outlook 2007, since Word is always the editor.

>>
>> "Kooltou" <Kooltou RemoveThis @discussions.microsoft.com> wrote in message news:5B44C891-85E4-4826-9F8B-1DAD92E9EC91@microsoft.com...
>> > Hello!
>> >
>> > I need to write a simple macro for Outlook 2007.
>> >
>> > I would like it to simply insert several lines of text in the active message
>> > window.
>> >
>> > In Outlook/Word 2003, I used the selection.typetext command. What would I
>> > use in Outlook 2007?
>> >
>> > If it matters, the messages are (and need to be) plain text.
>> >
>> > Thanks in advance!
>> >
>> > Kind Regards,
>> >
>>
Back to top
Kooltou
External


Since: Mar 19, 2007
Posts: 3



PostPosted: Mon Mar 19, 2007 9:55 pm    Post subject: Re: Outlook Macro - TypeText [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hi!

I have it all working now.

Thank you for your assistance!

Kind Regards,



"Sue Mosher [MVP-Outlook]" wrote:

> Your previous code was apparently a Word macro, not an Outlook macro. In an Outlook macro, you must first return a Word.Document object from the current item. For example:
>
> Set objDoc = Application.ActiveInspector.WordEditor
> Set objSel = objDoc.Windows(1).Selection
> objSel.TypeText Text:="Hello!"
>
> --
> Sue Mosher, Outlook MVP
> Author of Configuring Microsoft Outlook 2003
> http://www.turtleflock.com/olconfig/index.htm
> and Microsoft Outlook Programming - Jumpstart for
> Administrators, Power Users, and Developers
> http://www.outlookcode.com/jumpstart.aspx
>
> "Kooltou" <Kooltou.TakeThisOut@discussions.microsoft.com> wrote in message news:38EDA99E-C0FE-4150-82E5-2BA36F9C4466@microsoft.com...
> > Hello!
> >
> > Thanks for the reply.
> >
> > Here was my previous code:
> >
> > ~~~~~~~~~
> > Sub InsertText()
> > Selection.TypeText Text:="Hello!"
> > End Sub
> > ~~~~~~~~~
> >
> > However, VBA does not now recognize the 'application' object, and I get an
> > error message "Object Required"
> >
> > Thank you,
> >
> > "Sue Mosher [MVP-Outlook]" wrote:
> >
> >> You should be able to use the same technique in Outlook 2007, since Word is always the editor.
>
> >>
> >> "Kooltou" <Kooltou.TakeThisOut@discussions.microsoft.com> wrote in message news:5B44C891-85E4-4826-9F8B-1DAD92E9EC91@microsoft.com...
> >> > Hello!
> >> >
> >> > I need to write a simple macro for Outlook 2007.
> >> >
> >> > I would like it to simply insert several lines of text in the active message
> >> > window.
> >> >
> >> > In Outlook/Word 2003, I used the selection.typetext command. What would I
> >> > use in Outlook 2007?
> >> >
> >> > If it matters, the messages are (and need to be) plain text.
> >> >
> >> > Thanks in advance!
> >> >
> >> > Kind Regards,
> >> >
> >>
>
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