ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Accessing Mutiple TextBoxes (https://www.excelbanter.com/excel-programming/312184-accessing-mutiple-textboxes.html)

TimBro[_3_]

Accessing Mutiple TextBoxes
 

Hi again,

just googled around and discovered that the TextBoxes from the drawin
Toolbar kann handle up to 32,767 Character in Excel 97 ... how com
only 255 were saved to the array when I ran your code Peter ?

Regards
Ti

--
TimBr
-----------------------------------------------------------------------
TimBro's Profile: http://www.excelforum.com/member.php...fo&userid=1491
View this thread: http://www.excelforum.com/showthread.php?threadid=26541


Peter T[_3_]

Accessing Mutiple TextBoxes
 
For some odd reason, with strings over 255 in (drawing)
textboxes you need to read or write in chunks of up to
255, something like this:

Sub test3()
Dim str1 As String, str2 As String, shp As Shape
Dim j As Long, i as long

'manually create a textbox named "Text Box 3"
Set shp = ActiveSheet.Shapes("Text Box 3")

For j = 1 To 5
For i = 1 To 250
str1 = str1 & Chr(64 + j)
Next
str1 = str1 & vbLf & vbLf
Next
MsgBox Len(str1)
With shp
'write
j = 1

Do While j < Len(str1)
s = Mid(str1, j, 250)
.TextFrame.Characters(j).Insert String:=s
j = j + 250
Loop
MsgBox .TextFrame.Characters.Count

'read
j = 1
Do While j < .TextFrame.Characters.Count
str2 = str2 & .TextFrame.Characters(j, 250).Text
j = j + 250
MsgBox Len(str2)
Loop

End With
MsgBox Len(str2)
Debug.Print str2
End Sub

Regards,
Peter

-----Original Message-----

Hi again,

just googled around and discovered that the TextBoxes

from the drawing
Toolbar kann handle up to 32,767 Character in Excel

97 ... how come
only 255 were saved to the array when I ran your code

Peter ?

Regards
Tim


--
TimBro
----------------------------------------------------------

--------------
TimBro's Profile: http://www.excelforum.com/member.php?

action=getinfo&userid=14912
View this thread:

http://www.excelforum.com/showthread...hreadid=265419

.



All times are GMT +1. The time now is 10:22 PM.

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