ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copying text from text box (https://www.excelbanter.com/excel-programming/414179-copying-text-text-box.html)

Daniel Bonallack

Copying text from text box
 
Is there any way to copy out the text from a text box to a cell, even when
the text length is greater than 255 characters?

Currently, my copy is getting truncated to the first 255 characters.

thanks in advance
Daniel


Charlie

Copying text from text box
 
It's working ok for me:

TextBox1.Value = Space(20000)
Cells(1, 1).Value = TextBox1.Value
Debug.Print Len(Cells(1, 1))

check the MaxLength property of your textbox. Set it to zero.

"Daniel Bonallack" wrote:

Is there any way to copy out the text from a text box to a cell, even when
the text length is greater than 255 characters?

Currently, my copy is getting truncated to the first 255 characters.

thanks in advance
Daniel


Daniel Bonallack

Copying text from text box
 
Hi Charlie,

Thanks for the solution, but I think I didn't post very clearly. I'm
talking about an actual drawing object textbox, rather than a textbox in a
form. Any thoughts on that?

Daniel

"Charlie" wrote:

It's working ok for me:

TextBox1.Value = Space(20000)
Cells(1, 1).Value = TextBox1.Value
Debug.Print Len(Cells(1, 1))

check the MaxLength property of your textbox. Set it to zero.

"Daniel Bonallack" wrote:

Is there any way to copy out the text from a text box to a cell, even when
the text length is greater than 255 characters?

Currently, my copy is getting truncated to the first 255 characters.

thanks in advance
Daniel


Bob Phillips

Copying text from text box
 
Hi Daniel,

Long time no hear.

Try this


Sub LoadCellFromTextbox()
Dim tbox As Shape
Dim tmp As String
Dim tbLen As Long
Dim i As Long

Set tbox = ActiveSheet.Shapes("Text Box 1")
tbLen = tbox.TextFrame.Characters.Count
For i = 1 To tbLen Step 255

tmp = tmp & tbox.TextFrame.Characters(i, 255).Text
Next i
ActiveCell.Value = tmp
End Sub


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Daniel Bonallack" wrote in
message ...
Hi Charlie,

Thanks for the solution, but I think I didn't post very clearly. I'm
talking about an actual drawing object textbox, rather than a textbox in a
form. Any thoughts on that?

Daniel

"Charlie" wrote:

It's working ok for me:

TextBox1.Value = Space(20000)
Cells(1, 1).Value = TextBox1.Value
Debug.Print Len(Cells(1, 1))

check the MaxLength property of your textbox. Set it to zero.

"Daniel Bonallack" wrote:

Is there any way to copy out the text from a text box to a cell, even
when
the text length is greater than 255 characters?

Currently, my copy is getting truncated to the first 255 characters.

thanks in advance
Daniel





All times are GMT +1. The time now is 04:10 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com