Article ID: 148815 - View products that this article applies to.
This article was previously published under Q148815
In a Microsoft Excel worksheet, you can use TextBox objects to add text that is not limited by the boundary of a cell. You can also use text boxes on dialog sheets and chart sheets when specially formatted text is required.
The text string that is copied to or from a TextBox object has a 255- character restriction when you use the Characters method in Visual Basic for Applications. In other words, although a text box is capable of holding approximately 2,000 characters, the text must be added in strings that are no more that 255 characters in length. You can use the Sub procedures in the "More Information" section of this article to work around this restriction.
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers 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 requirements. The first Sub procedure (that is, TextBox_To_TextBox) demonstrates how to copy text from one TextBox DrawingObject into another text box. The second Sub procedure Cell_Text_To_TextBox, demonstrates a method that you can use to copy the value of a range of cells into a text box.
The following Sub procedure copies the text from one text box on the active sheet to another text box on the active sheet.
Sample Visual Basic Procedures
The following Sub procedure copies the values from a range of cells that you specify into a text box on the active sheet.
For additional information about getting help with Visual Basic for Applications, please see the following article in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/163435/EN-US/ )VBA: Programming Resources for Visual Basic for Applications
Article ID: 148815 - Last Review: September 12, 2006 - Revision: 3.2
Contact us for more help
Connect with Answer Desk for expert help.