XL97: RTF Code Copied to Cell When Using TextRTF Property

Last reviewed: March 13, 1998
Article ID: Q171373
The information in this article applies to:
  • Microsoft Excel 97 for Windows

SYMPTOMS

If you use the TextRTF property for a RichTextBox ActiveX control to populate a worksheet cell, Rich Text Format (RTF) code may appear in the cell.

CAUSE

This problem occurs because the TextRTF property returns the text of a RichTextBox control, including all RTF code, and Microsoft Excel cannot interpret RTF code that is copied to a cell with a macro. This is true even though you can manually apply rich text formatting in a worksheet cell.

RESOLUTION

You cannot use the TextRTF property to place the contents of a RichTextBox control without the RTF code into a worksheet cell. Instead, use the Text property to return the contents of a RichTextBox control to a worksheet cell. However, note that the text property does not support rich text formatting.

MORE INFORMATION

The RichTextBox control is part of a collection of ActiveX controls that is included with the Office Developers Edition CD. It provides properties you can use to apply formatting to any portion of text within the control. To change the formatting of text, you must select it first. Only selected text can be assigned character and paragraph formatting. By using these properties, you can make text bold or italic, change the color, and create superscript and subscript text. You can also adjust paragraph formatting by setting both left and right indents, and you can create hanging indents.

For additional information, please see the following articles in the Microsoft Knowledge Base:

   ARTICLE-ID: QK170232
   TITLE     : XL97: Printing Formatted Text from a RichTextBox Control

   ARTICLE-ID: Q165450
   TITLE     : XL97: Error Inserting ActiveX Object in a Worksheet

REFERENCES

For more information about the RichTextBox control, add a RichTextBox control to a UserForm, select the control, and then press F1.


Additional query words: XL97
Keywords : kbprg
Version : WINDOWS:97
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: March 13, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.