PC Review


Reply
Thread Tools Rate Thread

Copying text from text box

 
 
Daniel Bonallack
Guest
Posts: n/a
 
      17th Jul 2008
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

 
Reply With Quote
 
 
 
 
Charlie
Guest
Posts: n/a
 
      17th Jul 2008
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
>

 
Reply With Quote
 
Daniel Bonallack
Guest
Posts: n/a
 
      17th Jul 2008
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
> >

 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      17th Jul 2008
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" <(E-Mail Removed)> wrote in
message news:F55CF376-AC5D-4697-89DC-(E-Mail Removed)...
> 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
>> >



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying text from website OR selecting and coping certain text within a cell keri Microsoft Excel Programming 2 12th Apr 2007 11:23 PM
Copying text from MS-Word to Rich-Text clients =?Utf-8?B?dmFzZGVlcA==?= Microsoft Word Document Management 1 23rd Dec 2006 03:15 AM
when i scroll after copying some text, the copied text is lost =?Utf-8?B?UGFyYXN1cmFtYW4=?= Microsoft Word Document Management 0 21st Mar 2005 12:25 AM
Text not copying as text from Word to Excel 2003 =?Utf-8?B?Q2hyaXN0aW5l?= Microsoft Excel Misc 4 3rd Mar 2005 11:33 PM
When copying text and pasting, text doesn't get pasted =?Utf-8?B?ZHVuZWJ1Z2dlcg==?= Microsoft Word Document Management 2 18th Oct 2004 12:45 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:37 AM.