Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

XL2000: RTF Code Copied to Cell When You Use the TextRTF Property


View products that this article applies to.

This article was previously published under Q213693

↑ Back to the top


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.

↑ Back to the top


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.

↑ Back to the top


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.

↑ Back to the top


More information

The RichTextBox control is part of a collection of ActiveX controls that are included with the Office Developers Edition compact disc (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.

↑ Back to the top


References

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

↑ Back to the top


Keywords: KB213693, kbprogramming, kbprb

↑ Back to the top

Article Info
Article ID : 213693
Revision : 6
Created on : 10/11/2006
Published on : 10/11/2006
Exists online : False
Views : 232