Changing text in grouped shapes

J

Joe

I am using Visio 2002 and have a shape group in chich I would like to change the text in one of the shapes. The first shape (Shape A) is a bitmap and the second is a textbox.

If I execute the following code, I am not able to retrieve the text from the textbox in the grouped shapes. If I seperate the grouped shapes and run the code, I can retrieve the text from the textbox.

Code:

Sub m()
Dim s As Shape
Dim t As String
On Error Resume Next
For Each s In ThisDocument.Pages(1).Shapes
t = vbNullString
t = s.Name & vbCrLf
t = t & s.Type & vbCrLf
t = t & s.AreaIU & vbCrLf
t = t & s.Text & vbCrLf
t = t & s.ContainingPage.Name
MsgBox t
Next s

End Sub

Does anyone know how to access and change the data in the grouped shape?

Thanks,

Joe
 
A

Al Edlund

you have to go into the shape and change the data in the embedded shape,
something like this

If visShape.Type = visTypeGroup Then
'Debug.Print "it is a group"
for Icnt = 1 to visShapes.Shapes.Count
Set visEmbShape = visShape.Shapes(Icnt)
'Debug.Print "instantiate the embedded shape"
' do what you need to do (test it, change it, whatever)
next Icnt
End If

Joe said:
I am using Visio 2002 and have a shape group in chich I would like to
change the text in one of the shapes. The first shape (Shape A) is a bitmap
and the second is a textbox.
If I execute the following code, I am not able to retrieve the text from
the textbox in the grouped shapes. If I seperate the grouped shapes and run
the code, I can retrieve the text from the textbox.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top