A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

How do I append text to the body of a email?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 8th 06, 09:51 PM posted to microsoft.public.outlook.program_vba
Beginner
external usenet poster
 
Posts: 3
Default How do I append text to the body of a email?

Hello,
I am new to VBA and object model programming with OutLook. Can someone
assist me in developing VBA for OutLook that add text to the body of the
email message without deleting what is already their?

The simple code below erases the current text and add the text I have
assigned to be put into the body. HELP....

Sub AddLinks()
Dim MyItem As MailItem
Dim MyAtt As Attachment
Const dPath = "file://d:\"
Set SelectedItems = ActiveExplorer.Selection
For Each MyItem In SelectedItems
MyItem.Body = dPath
MyItem.Save
Next
MsgBox "Processing Completed!"
End Sub
Ads
  #2  
Old February 8th 06, 11:26 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default How do I append text to the body of a email?

This is the syntax for appending text to a variable:

strMyText = strMyText & vbCrLf & "another line of text"

The & operator is used to concatenate (join together) one string with another. vbCrLf is an intrinsic constant that represents the carriage return/line feed characters.

So, if you want to append text to MyItem.Body, the structure of the statement would be identical to that above:

MyItem.Body = MyItem.Body & vbCrLf & dPath

Or, don't include the vbCrLf if you don't need dPath on its own line.

--
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


"Beginner" wrote in message ...
Hello,
I am new to VBA and object model programming with OutLook. Can someone
assist me in developing VBA for OutLook that add text to the body of the
email message without deleting what is already their?

The simple code below erases the current text and add the text I have
assigned to be put into the body. HELP....

Sub AddLinks()
Dim MyItem As MailItem
Dim MyAtt As Attachment
Const dPath = "file://d:\"
Set SelectedItems = ActiveExplorer.Selection
For Each MyItem In SelectedItems
MyItem.Body = dPath
MyItem.Save
Next
MsgBox "Processing Completed!"
End Sub

  #3  
Old February 9th 06, 09:36 PM posted to microsoft.public.outlook.program_vba
Beginner
external usenet poster
 
Posts: 3
Default How do I append text to the body of a email?

Sue,
The statement correction you added to my VBA worked, Thanks for your
assistance.

Beginner

"Sue Mosher [MVP-Outlook]" wrote:

This is the syntax for appending text to a variable:

strMyText = strMyText & vbCrLf & "another line of text"

The & operator is used to concatenate (join together) one string with another. vbCrLf is an intrinsic constant that represents the carriage return/line feed characters.

So, if you want to append text to MyItem.Body, the structure of the statement would be identical to that above:

MyItem.Body = MyItem.Body & vbCrLf & dPath

Or, don't include the vbCrLf if you don't need dPath on its own line.

--
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


"Beginner" wrote in message ...
Hello,
I am new to VBA and object model programming with OutLook. Can someone
assist me in developing VBA for OutLook that add text to the body of the
email message without deleting what is already their?

The simple code below erases the current text and add the text I have
assigned to be put into the body. HELP....

Sub AddLinks()
Dim MyItem As MailItem
Dim MyAtt As Attachment
Const dPath = "file://d:\"
Set SelectedItems = ActiveExplorer.Selection
For Each MyItem In SelectedItems
MyItem.Body = dPath
MyItem.Save
Next
MsgBox "Processing Completed!"
End Sub


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Missing Body Text But Appears When Replying or Forwarding Asin Outlook - Installation 0 February 7th 06 01:42 AM
Dragging an email to the Calendar drops the email body text yan Outlook - Calandaring 2 February 1st 06 01:23 AM
New email opens with questions already in the body. [email protected](DO NOT SPAM) Outlook - Using Forms 1 January 25th 06 02:05 PM
Photos embedded in body of text? Pete Stolz Outlook - General Queries 0 January 22nd 06 03:58 PM
How do I get incoming .jpg's to show up in my text body Scott Outlook - General Queries 1 January 11th 06 08:47 PM


All times are GMT +1. The time now is 03:39 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.