vbavisioshapesheet

How to add a shape to a group with VBA in Visio


How can you add a shape into an existing group in visio, without ungrouping because I have many custom properties into my group shapesheet. I dont want subformulas using it to be broken.

Here is the beginning of my VBA code but I can't find a method to add the shape in the group.

Sub moveToGroup(OrigineShape As Shape, DestinationGroup As Shape)


End Sub

Thank you all for your answers.


Solution

  • It was actually quite simple!

    Sub moveToGroup(OrigineShape As Shape, DestinationGroup As Shape)
        OrigineShape.Parent = DestinationGroup
    End Sub
    

    Just remember not to use Set for this assignment, as doing so generates an error.