0 Members and 1 Guest are viewing this topic.

Private Sub Button12_Click(sender As Object, e As RibbonControlEventArgs) Handles Button12.Click Dim Ang As Double Dim shp As Visio.Shape Dim x As Double, y As Double Dim pi As Double Dim win As Visio.Window pi = Math.PI Ang = Convert.ToDecimal(EditBox1.Text) * pi / 180.0 win = Globals.ThisAddIn.Application.ActiveWindow If win.Selection.Count <> 1 Then Exit Sub shp = win.Selection(1) If Not shp.CellExistsU("BeginX", False) Then Exit Sub x = shp.Cells("BeginX").Result("mm") + (shp.Cells("EndX").Result("mm") - shp.Cells("BeginX").Result("mm")) * Math.Cos(Ang) _ - (shp.Cells("EndY").Result("mm") - shp.Cells("BeginY").Result("mm")) * Math.Sin(Ang) y = shp.Cells("BeginY").Result("mm") + (shp.Cells("EndX").Result("mm") - shp.Cells("BeginX").Result("mm")) * Math.Sin(Ang) _ + (shp.Cells("EndY").Result("mm") - shp.Cells("BeginY").Result("mm")) * Math.Cos(Ang) shp.Cells("EndX").Formula = Str(x) + "mm" shp.Cells("EndY").Formula = Str(y) + "mm" End SubEnd Class