Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with text box limit (1024)
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with text box limit (1024)
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with text box limit (1024)
My mistake, you are correct. When checking I only scanned and now
see that I got 1024 from the "Length of formula contents" instead of the "Length of cell contents (text)". Regardless, I think it would be hard to use VBA to break up text (into comprehensible chunks) using carefully positioned carriage returns. Though their are probably better ways to break up the text than my (cut it off at 1024) approach. Thank you, Dan E "Dave Peterson" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel text export limit - 1024 per line (not cell), workaround? | Excel Discussion (Misc queries) | |||
Any ideas how to copy more than 1024 characters? | New Users to Excel | |||
Error message is Character Limit is over 1024 characters | Excel Discussion (Misc queries) | |||
how do i get a cell in a sheet to show the last 1024 characters? | Excel Worksheet Functions | |||
Display text 1024 characters in a cell | Excel Worksheet Functions |