Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel text export limit - 1024 per line (not cell), workaround? Dave Excel Discussion (Misc queries) 11 August 11th 09 04:41 PM
Any ideas how to copy more than 1024 characters? toolman74 New Users to Excel 6 April 14th 09 05:02 PM
Error message is Character Limit is over 1024 characters Vick Excel Discussion (Misc queries) 2 January 30th 09 06:19 PM
how do i get a cell in a sheet to show the last 1024 characters? XenneX Excel Worksheet Functions 1 September 6th 06 02:02 PM
Display text 1024 characters in a cell Martin Excel Worksheet Functions 6 November 12th 05 11:25 PM


All times are GMT +1. The time now is 12:09 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"