Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / August 2004

Tip: Looking for answers? Try searching our database.

creating a macro for inserting text

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
david - 26 Aug 2004 16:08 GMT
i'd like to have a macro that i can run which will insert
a specified list of words. can anyone tell me the code to
insert text into an outlook message.

thanks
Mike Maenpaa - 26 Aug 2004 16:49 GMT
Download the DOC file here to learn how
http://www.microsoft.com/office/previous/outlook/supreasy.asp

Mike

> i'd like to have a macro that i can run which will insert
> a specified list of words. can anyone tell me the code to
> insert text into an outlook message.
>
> thanks
Eric Legault [MVP - Outlook] - 26 Aug 2004 18:27 GMT
Try this macro:

Sub InsertWordsIntoEmailBody()
   Dim objInsp As Outlook.Inspector, objItem As Object
   Dim strWordArray(5) As String
   
   Set objInsp = Outlook.ActiveInspector
   
   If objInsp Is Nothing Then
       'No open e-mail message
       Exit Sub
   End If
   
   Set objItem = objInsp.CurrentItem
   
   strWordArray(0) = "My"
   strWordArray(1) = "string"
   strWordArray(2) = "array"
   strWordArray(3) = "list"
   strWordArray(4) = "of"
   strWordArray(5) = "words"
   
   objItem.Body = Join(strWordArray, ";") & vbNewLine & vbNewLine &
objItem.Body
End Sub

--
Eric Legault - B.A, MCP, MCSD, Outlook MVP
--------------------------------------------------
{Private e-mails ignored}
Job: http://www.imaginets.com
Blog: http://blogs.officezealot.com/legault/

> i'd like to have a macro that i can run which will insert
> a specified list of words. can anyone tell me the code to
> insert text into an outlook message.
>
> thanks
david - 28 Aug 2004 12:49 GMT
many thanks that works.
can you tell me how I can insert this list at the point
in the email where the cursor currently is?

>-----Original Message-----
>Try this macro:
[quoted text clipped - 37 lines]
>>
>.
Eric Legault [MVP - Outlook] - 30 Aug 2004 06:13 GMT
Unfortunately, you can't do that with the Outlook Object Model.  You need to
use the SafeInspector object from the third-party Redemption tool
(http://www.dimastr.com).

Eric Legault - B.A, MCP, MCSD, Outlook MVP
--------------------------------------------------
{Private e-mails ignored}
Job: http://www.imaginets.com
Blog: http://blogs.officezealot.com/legault/

> many thanks that works.
> can you tell me how I can insert this list at the point
[quoted text clipped - 44 lines]
> >>
> >.
Sriram - 31 Aug 2004 06:29 GMT
If you set Word as the email editor, you can use the Word AutoText feature
without any programming, to insert text at the cursor.

> many thanks that works.
> can you tell me how I can insert this list at the point
> in the email where the cursor currently is?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.