Article ID: 162995 - Last Review: February 12, 2007 - Revision: 1.3 OL97: VBScript Cannot Access Characters in the Body PropertyThis article was previously published under Q162995 SYMPTOMS
When you use Visual Basic Scripting Edition (VBScript), you cannot
programmatically insert information into the body of an Outlook item
without completely replacing the body.
CAUSE
The Outlook object model provides only one property for this part of the
item, the Body property. The Body property enables you to programmatically
create and delete the body text, but it does not enable you to insert or
modify information that is in the middle of the body.
For example, you may have a mail item with the following text in the body: ------------------------------- Thank you for using: We appreciate your business. -------------------------------
Item.Body = "This is new text" This example would completely replace
the existing text with the new text.
Because different server applications (Outlook, WordMail, and so on.) can
provide the Body property of a mail message, there is no one, common object
model to facilitate modifications within the Body property.
Item.Body = "" This example would completely delete the text. WORKAROUNDMicrosoft provides programming examples for illustration only, without warranty either
expressed or implied, including, but not limited to, the implied warranties of
merchantability and/or fitness for a particular purpose. This article assumes
that you are familiar with the programming language being demonstrated and the
tools used to create and debug procedures. Microsoft support professionals can
help explain the functionality of a particular procedure, but they will not
modify these examples to provide added functionality or construct procedures to
meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or Microsoft Advisory Services. For more information, visit these Microsoft Web sites: Microsoft Certified Partners - https://partner.microsoft.com/global/30000104 (https://partner.microsoft.com/global/30000104) Microsoft Advisory Services - http://support.microsoft.com/gp/advisoryservice (http://support.microsoft.com/gp/advisoryservice) For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site: http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS (http://support.microsoft.com/default.aspx?scid=fh;en-us;cntactms) The following Outlook VBScript enables you to insert text within the Body property of the example in the "Cause" section. It does so by parsing the existing text and re-inserting new body text. REFERENCES | Article Translations
|

Back to the top
