A cell in xl97 and up can contain up to 32767 characters. Excel's help says
that only 1024 are visible though. (you can get quite a few more if you add
some alt-enters in nice spots.)
I used xl2002 and made a small userform with a command button and a textbox and
I ran this code:
Option Explicit
Private Sub CommandButton1_Click()
Me.TextBox1.Value = Application.Rept("asdf ", 5000)
Range("a1").Value = Me.TextBox1.Text
MsgBox Len(Me.TextBox1.Value) & vbNewLine & Len(Range("a1").Value)
End Sub
The msgbox came back with 25000 for each.
Dan E wrote:
Irais,
The limit is of the cell, not the textbox. A cell can only store
1024 characters. So you need to break up the text before
putting it in the textboxes.
If Len(TextBox1.Value) 1024 Then
Range("A1").Value = Left(TextBox1.Value, 1024)
Range("A2").Value = Mid(TextBox1.Value, 1025, Len(TextBox1.Value) - 1024)
Else
Range("A1").Value = TextBox1.Value
End If
That'll do it for a max of 2048 characters. If you need to go
beyond that, post back.
Dan E
"irais" wrote in message ...
Hi
I need to store more than 1024 characters in a text box
(from a Form) and then save it into an excel cell.
If it is less than 1024 characters it works fine.
Any ideas?
All help is apreciated.
Irais.
--
Dave Peterson