How use the GlueTo Method with 2D Shapes

Feb 6, 2017
Reaction score
Public Sub Document_ShapeAdded(ByVal vsoShapeAdded As IVShape)
Dim vsoShapeOnPage As Visio.Shape
Dim vsoDocument As Visio.Document
Dim vsoPage As Visio.Page
Dim vsoReturnedSelection As Visio.Selection
Dim intSpatialRelation As VisSpatialRelationCodes
intSpatialRelation = visSpatialOverlap + visSpatialContainedIn
Set vsoReturnedSelection = vsoShapeAdded.SpatialNeighbors(intSpatialRelation, 0, 0)
    'Evaluate the results.
    If vsoReturnedSelection.Count = 0 Then
        'Aucune forme satisfait aux critères établis par les arguments de la méthode.
        strSpatialRelation = vsoShapeAdded.Name & " is not contained."
        'Build the positive result string.
        For Each vsoShapeOnPage In vsoReturnedSelection
           If vsoShapeOnPage.Name Like "Function*" And vsoShapeAdded.Name Like "port*" Then
               strSpatialRelation = strSpatialRelation & vsoShapeAdded.Name & " is contained by " & vsoShapeOnPage.Name & Chr$(10)
               '---> Il faut coller les Shape avec la methode GlueTo
'               expression.GlueTo (CellObject)
'               expression Variable qui représente un objet Cell
            End If
    End If
'Display the results on the shape added.
 vsoShapeAdded.Text = strSpatialRelation
End Sub
Hi !

I need your brains to solve a small problem that I have encountered just recently.

Indeed, My program is using the SpatialNeighbors property to find out if one shape is contained in another. if I have a Shape which is contained in an another Shape so I have to stick my shapes with the GlueTo method. But I have trouble using this method.

I'm using for the moment only 2-D shapes..

Thank you for your help :)

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