PC Review


Reply
Thread Tools Rate Thread

Appropriate Object To Hold Memo-Sized Text?

 
 
PeteCresswell
Guest
Posts: n/a
 
      23rd Jul 2007
Looks like .Shapes.AddTextBox creates an object that will only hold
up to 255 chars.

e.g. .Shapes("txtWhatever").TextFrame.Characters.Text = string(255,
"A") works, but
..Shapes("txtWhatever").TextFrame.Characters.Text = string(256, "A")
just quietly fails to add the text without trapping out.

Is there a more appropriate object to use when loading larger amounts
of text? 32,760 would probably suffice.

Or should I just define a range that points to a monster cell?

 
Reply With Quote
 
 
 
 
Peter T
Guest
Posts: n/a
 
      23rd Jul 2007
You need to add characters in chunks of 255 or less into a textbox, eg -

Sub test()
Dim shp As Shape
Dim sText As String, sPart As String

For i = 65 To 84
For j = 1 To 1000
sText = sText & Chr(i)
Next
sText = sText & vbLf
Debug.Print Len(sText)
Next

'MsgBox Len(sText)

Set shp = ActiveSheet.Shapes.AddTextbox(1, 10, 10, 600, 3000)

With shp
j = 1
Do While j < Len(sText)
sPart = Mid$(sText, j, 250)
.TextFrame.Characters(j).Insert String:=sPart
j = j + 250
Loop
End With

End Sub


With a very long strings, 15-20k or more, the textbox does not always
receive all characters, though without error and no particular defined
limit. Seems to partly depend on the initial size of the textbox. For your
32k it might be worth looking at an appropriate 'embedded' app to hold the
text, eg Word or Notepad.

Regards,
Peter T



"PeteCresswell" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Looks like .Shapes.AddTextBox creates an object that will only hold
> up to 255 chars.
>
> e.g. .Shapes("txtWhatever").TextFrame.Characters.Text = string(255,
> "A") works, but
> .Shapes("txtWhatever").TextFrame.Characters.Text = string(256, "A")
> just quietly fails to add the text without trapping out.
>
> Is there a more appropriate object to use when loading larger amounts
> of text? 32,760 would probably suffice.
>
> Or should I just define a range that points to a monster cell?
>



 
Reply With Quote
 
(PeteCresswell)
Guest
Posts: n/a
 
      23rd Jul 2007
Per Peter T:
>With a very long strings, 15-20k or more, the textbox does not always
>receive all characters, though without error and no particular defined
>limit. Seems to partly depend on the initial size of the textbox. For your
>32k it might be worth looking at an appropriate 'embedded' app to hold the
>text, eg Word or Notepad.


Short of a proper embedded application object, what do you think
about just pushing it into a .Range made up of many merged cells
- which is what I'm doing now, just to get something to show the
client?

Only reason I got off on the TextBox tangent was the appeal of
object names whose scope was limited to a worksheet. e.g. If I
have 25 funds - each with their own worksheet - I can push the
text into "txtComment" on each sheet, rather than having to
custom-name a range for each sheet.
--
PeteCresswell
 
Reply With Quote
 
Peter T
Guest
Posts: n/a
 
      23rd Jul 2007
Yes, a cell can store and display 32K, depending on layout perhaps it might
be easier in some merged cells.

> rather than having to
> custom-name a range for each sheet.


Not quite sure what the problem is with that but FWIW, if you define at
worksheet level, each sheet can contain the same Name which may or may not
refer to same cell address on each sheet.

Regards,
Peter T

"(PeteCresswell)" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Per Peter T:
> >With a very long strings, 15-20k or more, the textbox does not always
> >receive all characters, though without error and no particular defined
> >limit. Seems to partly depend on the initial size of the textbox. For

your
> >32k it might be worth looking at an appropriate 'embedded' app to hold

the
> >text, eg Word or Notepad.

>
> Short of a proper embedded application object, what do you think
> about just pushing it into a .Range made up of many merged cells
> - which is what I'm doing now, just to get something to show the
> client?
>
> Only reason I got off on the TextBox tangent was the appeal of
> object names whose scope was limited to a worksheet. e.g. If I
> have 25 funds - each with their own worksheet - I can push the
> text into "txtComment" on each sheet, rather than having to
> custom-name a range for each sheet.
> --
> PeteCresswell



 
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
ACCESS 2003 memo field/data type will only hold 255 Characters why =?Utf-8?B?TU9OVEdP?= Microsoft Access 4 28th Sep 2005 11:18 PM
variable-sized memo field in report Christopher Glaeser Microsoft Access Reports 1 7th Mar 2005 11:17 PM
Printing a legal sized document on letter sized paper Paula O. Microsoft Excel Programming 0 2nd Feb 2004 06:55 PM
Printing Custom Sized Slides on letter sized paper Andrew Microsoft Powerpoint 1 4th Nov 2003 09:43 PM
Re: Trying to make a memo field hold more than 64000 Kurtis Microsoft Access Queries 1 16th Jul 2003 11:19 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:41 PM.