René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

Connect Rectangles [Visio Macros]

Sub ConnectTwoRectangles()
 
  Dim rect1 As Visio.Shape
  Dim rect2 As Visio.Shape
  Dim line  As Visio.Shape
  
  Set rect1 = ActivePage.DrawRectangle(1, 4, 3, 7)
  Set rect2 = ActivePage.DrawRectangle(4, 2, 7, 3)
  Set line = ActivePage.DrawLine(0, 0, 0, 0)
  
  rect1.Text = "First"
  rect2.Text = "Second"
    
  line.Cells("BeginX").GlueTo rect1.Cells("Geometry1.X2")
  line.Cells("EndX").GlueTo rect2.Cells("Geometry1.X4")
  
End Sub