Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Rectangle Size

i'm adding to a rectangle a text from a range 1 by 1 character like this:

ActiveSheet.Shapes("Rectangle 3").Select
For i = 1 To Len(Range("J17"))
Selection.Characters.Text = Selection.Characters.Text +
Mid(Range("J17").Value, i, 1)
Next

It works, but when i arrives to 255 don't let me fill the rest of the
rectangle.

Anyone Help?
Thanks



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,073
Default Rectangle Size

You can use Characters' Start and Length parameters.

Try this...

Option Explicit
Public Sub test()
Dim lnInitialCharCount As Long, k As Long
With ActiveSheet.Shapes("Rectangle 3")
lnInitialCharCount = .TextFrame.Characters.Count
Do While Len(Range("J17").Value) - (k * 255 - 254) 0
k = k + 1
..TextFrame.Characters(Start:=lnInitialCharCount + k * 255 - 254, _
Length:=255).Text = Mid(Range("J17").Value, k * 255 - 254, 255)
Loop
End With
End Sub

Ken Johnson

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Rectangle Size

it works

thanks Ken

"Ken Johnson" wrote:

You can use Characters' Start and Length parameters.

Try this...

Option Explicit
Public Sub test()
Dim lnInitialCharCount As Long, k As Long
With ActiveSheet.Shapes("Rectangle 3")
lnInitialCharCount = .TextFrame.Characters.Count
Do While Len(Range("J17").Value) - (k * 255 - 254) 0
k = k + 1
..TextFrame.Characters(Start:=lnInitialCharCount + k * 255 - 254, _
Length:=255).Text = Mid(Range("J17").Value, k * 255 - 254, 255)
Loop
End With
End Sub

Ken Johnson


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Rectangle Size

Another one:

Option Explicit
Sub testme()
Dim myRect As Shape
Dim myCell As Range
Dim cCtr As Long

With Worksheets("sheet1")
Set myRect = .Shapes("rectangle 3")
Set myCell = .Range("J17")

For cCtr = 1 To Len(myCell.Text) Step 255
With myRect.TextFrame
.Characters(.Characters.Count + 1).Insert _
String:=Mid(myCell.Text, cCtr, 255)
End With
Next cCtr
End With
End Sub

Tiago wrote:

i'm adding to a rectangle a text from a range 1 by 1 character like this:

ActiveSheet.Shapes("Rectangle 3").Select
For i = 1 To Len(Range("J17"))
Selection.Characters.Text = Selection.Characters.Text +
Mid(Range("J17").Value, i, 1)
Next

It works, but when i arrives to 255 don't let me fill the rest of the
rectangle.

Anyone Help?
Thanks


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Rectangle Symbol cs_jono Excel Discussion (Misc queries) 3 April 25th 08 09:29 PM
Rectangle Box Keyrookie Excel Worksheet Functions 1 January 27th 08 08:09 AM
Rounded Rectangle Adrian D. Bailey Excel Programming 3 March 26th 07 05:58 PM
Resizeable Rectangle Bill Bell Excel Programming 1 October 27th 03 08:34 PM
Add text to a rectangle in VBA pk Excel Programming 2 October 19th 03 02:44 AM


All times are GMT +1. The time now is 04:09 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"