I need to pass text strings longer than 255 characters from a cell (A1) to a textbox (TextBox 1) in Excel 2010. Some helpful people gave me this code (I don’t know how to program at all ), which seems to work for earlier versions of Excel, but not in Excel 2010.
Sub Looper()
Dim i As Integer
Dim mytxt As String
mytxt = Worksheets("Sheet1").Range("A1").Value
ActiveSheet.Shapes("TextBox 1").Select
With Selection
' Initialize text in text box.
.Text = ""
For i = 0 To Int(Len(mytxt) / 255)
.Characters(.Characters.Count + 1).Text = Mid(mytxt, (i * 255) + _
1, 255)
Next
End With
End Sub
I get an "application-defined or object-defined error" message in the “.characters(.Characters.Count…” line.
Any help would be great. Thanks!
Regards,
Carry
P.S. First post, first mistake. Sorry RoyUK
Bookmarks