![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
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 |