ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   shape grouping text (https://www.excelbanter.com/excel-programming/271728-re-shape-grouping-text.html)

Tom Ogilvy

shape grouping text
 
You could ungroup them, put in the text, then regroup

Sub A_AssignText()
Dim c1 As Shape
Dim c2 As Shape
Dim grp As Shape
Dim shp As Shape
Dim shp1 As Shape
Dim i as long
Dim arShapes() As Variant
Dim objRange As ShapeRange

Set grp = ActiveSheet.Shapes("group1")
ReDim arShapes(0 To grp.GroupItems.Count - 1)
i = 0
For Each shp In grp.GroupItems
arShapes(i) = shp.Name
i = i + 1
Next
grp.Ungroup
Set objRange = ActiveSheet.Shapes.Range(arShapes)
Set c1 = ActiveSheet.Shapes("Circ1")
Set c2 = ActiveSheet.Shapes("Circ2")
c1.TextFrame.Characters.Text = "c1"
c2.TextFrame.Characters.Text = "c2"
Set shp1 = objRange.Group
shp1.Name = "group1"
End Sub

Tested in xl2000, SR1

Regards,
Tom Ogilvy

"msnews.microsoft.com" wrote in message
...
I'm trying to design a shape thats basicly a rectangle with two inneer
circles. Basicly I need to be able to asign from code text to each of the
inner circles.

I've tried the following but dosen't work:
Dim c1 As Shape
Dim c2 As Shape
Dim grp As Shape

Set grp = Sheet1.Shapes("group1")
Set c1 = grp.GroupItems("circ1")
Set c2 = grp.GroupItems("circ2")

c1.TextFrame.Characters.Text = "c1"
c2.TextFrame.Characters.Text = "c2"

Two problems 1) aperently groupitems(name) cant find the circles, works

fine
with index. 2) textframe.characters.text dose not work when items are
grouped.

Is this the way it works, or am I missing something?







All times are GMT +1. The time now is 12:03 PM.

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