View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default 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