Je suis en train de coller une forme à l'autre dans Visio en utilisant GlueToVisio GlueTo méthode Retourne « objet cible inappropriée pour cette action »
Voici le code
Set trgObj = Cell.shape.Document.Masters("Trigger").Shapes(1)
Dim x As shape
Set x = ActivePage.Drop(trgObj, flowConnector.CellsU("PinX"), flowConnector.CellsU("PinY"))
Dim vsoCell1 As Visio.Cell
Dim vsoCell2 As Visio.Cell
Set vsoCell1 = x.CellsU("PinX")
Set vsoCell2 = Application.ActiveWindow.Page.Shapes.ItemFromID(flowConnector.ID).CellsSRC(7, 1, 0)
vsoCell1.GlueTo vsoCell2
'The following code I obtained through running a macro in visio
'Dim vsoCell1 As Visio.Cell
'Dim vsoCell2 As Visio.Cell
'The following is the equivalent to x
'Set vsoCell1 = Application.ActiveWindow.Page.Shapes.ItemFromID(51).CellsU("PinX")
'The following is the equivalent to flowConnector
'Set vsoCell2 = Application.ActiveWindow.Page.Shapes.ItemFromID(12).CellsSRC(7, 1, 0)
'vsoCell1.GlueTo vsoCell2
retourne « objet cible inappropriée pour cette action ", mais ce qui est étrange, c'est que le code que j'utilise j'ai obtenu en enregistrant une macro. Je n'arrive pas à comprendre pourquoi le code fonctionne quand je l'enregistre dans une macro mais quand je l'utilise, ce n'est pas le cas. Si quelqu'un peut offrir de l'aide, je l'apprécierais grandement.